[TASK] Replace deprecated getMock method in Unit tests 88/48588/18
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 15 Jun 2016 15:22:20 +0000 (17:22 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Mon, 20 Jun 2016 08:33:04 +0000 (10:33 +0200)
The "getMock" method is deprecated starting with PHPUnit 5.4 and must
be replaced with the MockBuilder or the "createMock" method for simple
cases.

Resolves: #76647
Related: #76673
Releases: master
Change-Id: Ib177969abc1c7e67f6033ba62c5e9b405dc00656
Reviewed-on: https://review.typo3.org/48588
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Elmar Hinz <t3elmar@gmail.com>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
261 files changed:
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [changed mode: 0755->0644]
typo3/sysext/backend/Tests/Unit/Controller/File/FileControllerTest.php
typo3/sysext/backend/Tests/Unit/Controller/PageLayoutControllerTest.php
typo3/sysext/backend/Tests/Unit/Form/NodeFactoryTest.php
typo3/sysext/backend/Tests/Unit/Tree/Pagetree/DataProviderTest.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/BackendLayoutCollectionTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/DataProviderCollectionTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserSessionRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Service/ModuleDataStorageServiceTest.php
typo3/sysext/core/Classes/Tests/BaseTestCase.php
typo3/sysext/core/Tests/Unit/Authentication/AbstractUserAuthenticationTest.php
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.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/CacheFactoryTest.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/Collection/RecordCollectionRepositoryTest.php
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Configuration/FlexForm/FlexFormToolsTest.php
typo3/sysext/core/Tests/Unit/Core/BootstrapTest.php
typo3/sysext/core/Tests/Unit/Core/ClassLoadingInformationGeneratorTest.php
typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php
typo3/sysext/core/Tests/Unit/Database/DatabaseConnectionTest.php
typo3/sysext/core/Tests/Unit/Database/Query/BulkInsertTest.php
typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php
typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php
typo3/sysext/core/Tests/Unit/Database/RelationHandlerTest.php
typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php
typo3/sysext/core/Tests/Unit/Error/ProductionExceptionHandlerTest.php
typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php
typo3/sysext/core/Tests/Unit/Imaging/IconFactoryTest.php
typo3/sysext/core/Tests/Unit/Localization/LocalizationFactoryTest.php
typo3/sysext/core/Tests/Unit/Log/LoggerTest.php
typo3/sysext/core/Tests/Unit/Log/Processor/AbstractProcessorTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseWriterTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/FileWriterTest.php
typo3/sysext/core/Tests/Unit/Mail/MailerTest.php
typo3/sysext/core/Tests/Unit/Messaging/FlashMessageQueueTest.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/AbstractFileTest.php
typo3/sysext/core/Tests/Unit/Resource/BaseTestCase.php
typo3/sysext/core/Tests/Unit/Resource/FileTest.php
typo3/sysext/core/Tests/Unit/Resource/Filter/FileNameFilterTest.php
typo3/sysext/core/Tests/Unit/Resource/FolderTest.php
typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Index/IndexerTest.php
typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php
typo3/sysext/core/Tests/Unit/Resource/Processing/LocalPreviewHelperTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/AudioTagRendererTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/VideoTagRendererTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php
typo3/sysext/core/Tests/Unit/Resource/Repository/AbstractRepositoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceFactoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Resource/TextExtraction/PlainTextExtractorTest.php
typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Utility/FileExtensionFilterTest.php
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/DatabaseTreeDataProviderTest.php
typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/File/ExtendedFileUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php
typo3/sysext/dbal/Tests/Unit/Database/AbstractTestCase.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionOracleTest.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionTest.php
typo3/sysext/dbal/Tests/Unit/Database/SqlParserTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/TranslationTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Core/BootstrapTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/BackendUserGroupRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/CategoryRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/FileMountRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Error/ResultTest.php
typo3/sysext/extbase/Tests/Unit/Hook/DataHandler/CheckFlexFormValueTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/AbstractControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ArgumentTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ArgumentsTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/RequestTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/View/JsonViewTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ClassInfoFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/BackendTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Mapper/DataMapperTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/PersistenceManagerTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryResultTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/SessionTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbQueryParserTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Property/PropertyMapperTest.php
typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/FloatConverterTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/ObjectConverterTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
typo3/sysext/extbase/Tests/Unit/Scheduler/FieldProviderTest.php
typo3/sysext/extbase/Tests/Unit/Scheduler/TaskTest.php
typo3/sysext/extbase/Tests/Unit/Service/CacheServiceTest.php
typo3/sysext/extbase/Tests/Unit/Service/ExtensionServiceTest.php
typo3/sysext/extbase/Tests/Unit/Service/FlexFormServiceTest.php
typo3/sysext/extbase/Tests/Unit/Service/ImageScriptServiceTest.php
typo3/sysext/extbase/Tests/Unit/SignalSlot/DispatcherTest.php
typo3/sysext/extbase/Tests/Unit/Utility/DebuggerUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Utility/ExtensionUtilityTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/AlphanumericValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/BooleanValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/CollectionValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/DisjunctionValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/EmailAddressValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/FloatValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/GenericObjectValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/IntegerValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/NotEmptyValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/NumberRangeValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/NumberValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/RegularExpressionValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/StringValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/Validator/TextValidatorTest.php
typo3/sysext/extbase/Tests/Unit/Validation/ValidatorResolverTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/DownloadControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UpdateFromTerControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Controller/UploadExtensionFileControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Model/DownloadQueueTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/ConfigurationItemRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/RepositoryRepositoryTest.php
typo3/sysext/extensionmanager/Tests/Unit/Report/ExtensionStatusTest.php
typo3/sysext/extensionmanager/Tests/Unit/Service/ExtensionManagementServiceTest.php
typo3/sysext/extensionmanager/Tests/Unit/Task/UpdateExtensionListTaskTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ConfigurationUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ListUtilityTest.php
typo3/sysext/felogin/Tests/Unit/Controller/FrontendLoginControllerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Cache/FluidTemplateCacheTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessorTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/LegacyNamespaceExpressionNodeTest.php
typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ViewHelperResolverTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetContextTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestBuilderTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestHandlerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestTest.php
typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/FormFieldViewHelperBaseTestcase.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/BytesViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/CaseViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/HtmlentitiesDecodeViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ImageViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/TypolinkViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Uri/EmailViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Widget/Controller/PaginateControllerTest.php
typo3/sysext/form/Tests/Unit/Utility/TypoScriptToJsonConverterTest.php
typo3/sysext/form/Tests/Unit/Validator/AbstractValidatorTest.php
typo3/sysext/frontend/Tests/Functional/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/frontend/Tests/Functional/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/CaseContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php [changed mode: 0755->0644]
typo3/sysext/frontend/Tests/Unit/ContentObject/FilesContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/frontend/Tests/Unit/Page/CacheHashCalculatorTest.php
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php
typo3/sysext/frontend/Tests/Unit/Processor/GalleryProcessorTest.php
typo3/sysext/frontend/Tests/Unit/View/AdminPanelViewTest.php
typo3/sysext/indexed_search/Tests/Unit/IndexerTest.php
typo3/sysext/indexed_search/Tests/Unit/Utility/LikeWildcardTest.php
typo3/sysext/install/Tests/Unit/Controller/Action/Ajax/ExtensionCompatibilityTesterTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/StructureFacadeTest.php
typo3/sysext/install/Tests/Unit/Service/CoreVersionServiceTest.php
typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php
typo3/sysext/install/Tests/Unit/Status/StatusUtilityTest.php
typo3/sysext/install/Tests/Unit/View/JsonViewTest.php
typo3/sysext/install/Tests/Unit/ViewHelpers/Format/PhpErrorCodeViewHelperTest.php
typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php
typo3/sysext/recycler/Tests/Unit/Task/CleanerTaskTest.php
typo3/sysext/reports/Tests/Unit/Report/Status/Typo3StatusTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Evaluation/EvaluatorTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/BlowfishSaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/Md5SaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/Pbkdf2SaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/PhpassSaltTest.php
typo3/sysext/scheduler/Tests/Unit/Task/CachingFrameworkGarbageCollectionTest.php

old mode 100755 (executable)
new mode 100644 (file)
index 3817520..f47eb4a
@@ -54,7 +54,10 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $GLOBALS[$this->testGlobalNamespace] = array();
         GeneralUtility::flushInternalRuntimeCaches();
         $this->setUpBackend();
-        $this->matchCondition = $this->getMock(\TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::class, array('determineRootline'), array(), '', false);
+        $this->matchCondition = $this->getMockBuilder(\TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::class)
+            ->setMethods(array('determineRootline'))
+            ->disableOriginalConstructor()
+            ->getMock();
     }
 
     /**
@@ -67,7 +70,10 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             1 => array('uid' => 111, 'pid' => 101),
             0 => array('uid' => 101, 'pid' => 0)
         );
-        $GLOBALS['BE_USER'] = $this->getMock(BackendUserAuthentication::class, array('dummy'), array(), '', false);
+        $GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
     }
 
     /**
@@ -75,7 +81,9 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     private function setUpDatabaseMockForDeterminePageId()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array('exec_SELECTquery', 'sql_fetch_assoc', 'sql_free_result'));
+        $GLOBALS['TYPO3_DB'] = $this->getMockBuilder(\TYPO3\CMS\Core\Database\DatabaseConnection::class)
+            ->setMethods(array('exec_SELECTquery', 'sql_fetch_assoc', 'sql_free_result'))
+            ->getMock();
         $GLOBALS['TYPO3_DB']->expects($this->any())->method('exec_SELECTquery')->will($this->returnCallback(array($this, 'determinePageIdByRecordDatabaseExecuteCallback')));
         $GLOBALS['TYPO3_DB']->expects($this->any())->method('sql_fetch_assoc')->will($this->returnCallback(array($this, 'determinePageIdByRecordDatabaseFetchCallback')));
     }
@@ -499,7 +507,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function treeLevelConditionMatchesCurrentPageIdWhileEditingNewPage()
     {
-        $GLOBALS['SOBE'] = $this->getMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class, array(), array(), '', false);
+        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
         $GLOBALS['SOBE']->elementsData = array(
             array(
                 'table' => 'pages',
@@ -522,7 +530,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function treeLevelConditionMatchesCurrentPageIdWhileSavingNewPage()
     {
-        $GLOBALS['SOBE'] = $this->getMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class, array(), array(), '', false);
+        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
         $GLOBALS['SOBE']->elementsData = array(
             array(
                 'table' => 'pages',
@@ -600,7 +608,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function PIDupinRootlineConditionMatchesCurrentPageIdWhileEditingNewPage()
     {
-        $GLOBALS['SOBE'] = $this->getMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class, array(), array(), '', false);
+        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
         $GLOBALS['SOBE']->elementsData = array(
             array(
                 'table' => 'pages',
@@ -623,7 +631,7 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function PIDupinRootlineConditionMatchesCurrentPageIdWhileSavingNewPage()
     {
-        $GLOBALS['SOBE'] = $this->getMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class, array(), array(), '', false);
+        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
         $GLOBALS['SOBE']->elementsData = array(
             array(
                 'table' => 'pages',
index 695edc0..197fe25 100644 (file)
@@ -57,9 +57,18 @@ class FileControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array('toArray', 'getModificationTime', 'getExtension'), array(), '', false);
-        $this->folderResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array('getIdentifier'), array(), '', false);
-        $this->mockFileProcessor = $this->getMock(\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::class, array('getErrorMessages'), array(), '', false);
+        $this->fileResourceMock = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\File::class)
+            ->setMethods(array('toArray', 'getModificationTime', 'getExtension'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->folderResourceMock = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Folder::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->mockFileProcessor = $this->getMockBuilder(\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::class)
+            ->setMethods(array('getErrorMessages'))
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $this->fileResourceMock->expects($this->any())->method('toArray')->will($this->returnValue(array('id' => 'foo')));
         $this->fileResourceMock->expects($this->any())->method('getModificationTime')->will($this->returnValue(123456789));
index a01d8d3..8397d54 100644 (file)
@@ -35,11 +35,15 @@ class PageLayoutControllerTest extends UnitTestCase
     public function pageIsNotLockedForEditorsReturnsCorrectValue($isAdmin, $permissions, $editLock, $expected)
     {
         /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $beUserMock */
-        $beUserMock = $this->getMock(BackendUserAuthentication::class, ['isAdmin']);
+        $beUserMock = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['isAdmin'])
+            ->getMock();
         $beUserMock->method('isAdmin')->will($this->returnValue($isAdmin));
 
         /** @var PageLayoutController|\PHPUnit_Framework_MockObject_MockObject $pageController */
-        $pageController = $this->getMock(PageLayoutController::class, ['getBackendUser']);
+        $pageController = $this->getMockBuilder(PageLayoutController::class)
+            ->setMethods(['getBackendUser'])
+            ->getMock();
         $pageController->method('getBackendUser')->will($this->returnValue($beUserMock));
 
         $pageController->CALC_PERMS = $permissions;
index 2032efa..a454735 100644 (file)
@@ -271,7 +271,10 @@ class NodeFactoryTest extends UnitTestCase
         $this->expectExceptionCode(1431872546);
         $mockNode = new \stdClass();
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'), array(), '', false);
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $mockSubject->expects($this->once())->method('instantiate')->will($this->returnValue($mockNode));
         $mockSubject->create(array('renderType' => 'foo'));
     }
@@ -331,9 +334,11 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => \stdClass::class,
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->once())->method('instantiate')->with('stdClass')->will($this->returnValue($mockNode));
         $mockSubject->create($data);
     }
@@ -356,9 +361,11 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo2Class',
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->once())->method('instantiate')->with('foo2Class')->will($this->returnValue($mockNode));
         $mockSubject->create($data);
     }
@@ -381,9 +388,11 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo1Class',
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->once())->method('instantiate')->with('foo2Class')->will($this->returnValue($mockNode));
         $mockSubject->create($data);
     }
@@ -403,10 +412,12 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'fooClass',
             ),
         );
-        $mockResolver = $this->getMock(\stdClass::class);
+        $mockResolver = $this->getMockBuilder(\stdClass::class)->getMock();
 
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->at(0))->method('instantiate')->will($this->returnValue($mockResolver));
         $mockSubject->create($data);
     }
@@ -424,7 +435,7 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => \stdClass::class,
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
 
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433156887 => array(
@@ -438,11 +449,13 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo2Class',
             ),
         );
-        $mockResolver1 = $this->getMock(NodeResolverInterface::class);
-        $mockResolver2 = $this->getMock(NodeResolverInterface::class);
+        $mockResolver1 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
+        $mockResolver2 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
 
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->at(0))->method('instantiate')->with('foo2Class')->will($this->returnValue($mockResolver2));
         $mockSubject->expects($this->at(1))->method('instantiate')->with('foo1Class')->will($this->returnValue($mockResolver1));
         $mockSubject->expects($this->at(2))->method('instantiate')->will($this->returnValue($mockNode));
@@ -462,7 +475,7 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => \stdClass::class,
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
 
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433156887 => array(
@@ -476,11 +489,13 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo2Class',
             ),
         );
-        $mockResolver1 = $this->getMock(NodeResolverInterface::class);
-        $mockResolver2 = $this->getMock(NodeResolverInterface::class);
+        $mockResolver1 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
+        $mockResolver2 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
 
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->at(0))->method('instantiate')->with('foo1Class')->will($this->returnValue($mockResolver1));
         $mockSubject->expects($this->at(1))->method('instantiate')->with('foo2Class')->will($this->returnValue($mockResolver2));
         $mockSubject->expects($this->at(2))->method('instantiate')->will($this->returnValue($mockNode));
@@ -500,7 +515,7 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => \stdClass::class,
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
 
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433156887 => array(
@@ -509,11 +524,13 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo1Class',
             ),
         );
-        $mockResolver1 = $this->getMock(NodeResolverInterface::class);
+        $mockResolver1 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
         $mockResolver1->expects($this->once())->method('resolve')->will($this->returnValue('fooNodeClass'));
 
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->at(0))->method('instantiate')->will($this->returnValue($mockResolver1));
         $mockSubject->expects($this->at(1))->method('instantiate')->with('fooNodeClass')->will($this->returnValue($mockNode));
         $mockSubject->create($data);
@@ -532,7 +549,7 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => \stdClass::class,
             ),
         );
-        $mockNode = $this->getMock(NodeInterface::class, array(), array(), '', false);
+        $mockNode = $this->createMock(NodeInterface::class);
 
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'] = array(
             1433156887 => array(
@@ -546,11 +563,13 @@ class NodeFactoryTest extends UnitTestCase
                 'class' => 'foo2Class',
             ),
         );
-        $mockResolver1 = $this->getMock(NodeResolverInterface::class);
+        $mockResolver1 = $this->getMockBuilder(NodeResolverInterface::class)->getMock();
         $mockResolver1->expects($this->once())->method('resolve')->will($this->returnValue('fooNodeClass'));
 
         /** @var NodeFactory|\PHPUnit_Framework_MockObject_MockObject $mockSubject */
-        $mockSubject = $this->getMock(NodeFactory::class, array('instantiate'));
+        $mockSubject = $this->getMockBuilder(NodeFactory::class)
+            ->setMethods(array('instantiate'))
+            ->getMock();
         $mockSubject->expects($this->at(0))->method('instantiate')->with('foo1Class')->will($this->returnValue($mockResolver1));
         $mockSubject->expects($this->at(1))->method('instantiate')->with('fooNodeClass')->will($this->returnValue($mockNode));
         $mockSubject->create($data);
index 3092cf8..4e01cac 100644 (file)
@@ -31,7 +31,7 @@ class DataProviderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'] = array();
         $GLOBALS['LOCKED_RECORDS'] = array();
         /** @var $backendUserMock \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject */
-        $backendUserMock = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', false);
+        $backendUserMock = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $GLOBALS['BE_USER'] = $backendUserMock;
 
         $this->subject = new \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider();
index 109e586..4efcaa2 100644 (file)
@@ -223,7 +223,7 @@ class BackendUtilityTest extends UnitTestCase
      */
     public function getProcessedValueForSelectWithMMRelation()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->any())->method('fullQuoteStr')
             ->will($this->returnCallback(
                 function ($quoteStr) {
@@ -755,7 +755,7 @@ class BackendUtilityTest extends UnitTestCase
     public function getLabelsFromItemsListReturnsCorrectValue($table, $col, $keyList, $tca, array $pageTsConfig, $expectedLabel)
     {
         // Stub LanguageService and let sL() return the same value that came in again
-        $GLOBALS['LANG'] = $this->getMock(LanguageService::class, array(), array(), '', false);
+        $GLOBALS['LANG'] = $this->createMock(LanguageService::class);
         $GLOBALS['LANG']->expects($this->any())->method('sL')->will($this->returnArgument(0));
 
         $GLOBALS['TCA'][$table] = $tca;
@@ -784,7 +784,7 @@ class BackendUtilityTest extends UnitTestCase
             )
         );
         // Stub LanguageService and let sL() return the same value that came in again
-        $GLOBALS['LANG'] = $this->getMock(LanguageService::class, array(), array(), '', false);
+        $GLOBALS['LANG'] = $this->createMock(LanguageService::class);
         $GLOBALS['LANG']->expects($this->any())->method('sL')->will($this->returnArgument(0));
 
         $GLOBALS['TCA'][$table] = $tca;
@@ -812,7 +812,7 @@ class BackendUtilityTest extends UnitTestCase
             )
         );
         // Stub LanguageService and let sL() return the same value that came in again
-        $GLOBALS['LANG'] = $this->getMock(LanguageService::class, array(), array(), '', false);
+        $GLOBALS['LANG'] = $this->createMock(LanguageService::class);
         $GLOBALS['LANG']->expects($this->any())->method('sL')->will($this->returnArgument(0));
 
         $GLOBALS['TCA'][$table] = $tca;
@@ -859,7 +859,7 @@ class BackendUtilityTest extends UnitTestCase
             )
         );
 
-        $GLOBALS['BE_USER'] = $this->getMock(BackendUserAuthentication::class, array(), array(), '', false);
+        $GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
         $GLOBALS['BE_USER']->expects($this->at(0))->method('getTSConfig')->will($this->returnValue($completeConfiguration));
         $GLOBALS['BE_USER']->expects($this->at(1))->method('getTSConfig')->will($this->returnValue(array('value' => null, 'properties' => null)));
 
@@ -1017,7 +1017,7 @@ class BackendUtilityTest extends UnitTestCase
     public function replaceL10nModeFieldsReplacesFields($table, array $row, array $tca, array $originalRow, $expected)
     {
         $GLOBALS['TCA'] = $tca;
-        $GLOBALS['TYPO3_DB'] = $this->getMock(DatabaseConnection::class);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->any())->method('exec_SELECTgetSingleRow')->will($this->returnValue($originalRow));
 
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|BackendUtility $subject */
index 202ceb6..b2f5bd4 100644 (file)
@@ -51,7 +51,10 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $identifier = $this->getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
         $backendLayoutIdentifier = $this->getUniqueId('identifier__');
-        $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
 
         $backendLayoutCollection->add($backendLayoutMock);
@@ -67,9 +70,15 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $identifier = $this->getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
         $backendLayoutIdentifier = $this->getUniqueId('identifier');
-        $firstBackendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $firstBackendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $firstBackendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
-        $secondBackendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $secondBackendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $secondBackendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
 
         $backendLayoutCollection->add($firstBackendLayoutMock);
@@ -84,7 +93,10 @@ class BackendLayoutCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $identifier = $this->getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
         $backendLayoutIdentifier = $this->getUniqueId('identifier');
-        $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
 
         $backendLayoutCollection->add($backendLayoutMock);
index 9565e4e..a113377 100644 (file)
@@ -40,7 +40,7 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1381597629);
         $identifier = $this->getUniqueId('identifier__');
-        $dataProviderMock = $this->getMock('stdClass');
+        $dataProviderMock = $this->getMockBuilder('stdClass')->getMock();
 
         $this->dataProviderCollection->add($identifier, get_class($dataProviderMock));
     }
@@ -53,7 +53,7 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\LogicException::class);
         $this->expectExceptionCode(1381269811);
         $identifier = $this->getUniqueId('identifier');
-        $dataProviderMock = $this->getMock('stdClass');
+        $dataProviderMock = $this->getMockBuilder('stdClass')->getMock();
 
         $this->dataProviderCollection->add($identifier, get_class($dataProviderMock));
     }
@@ -65,8 +65,14 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $backendLayoutIdentifier = $this->getUniqueId('identifier');
 
-        $dataProviderMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class, array('getBackendLayout'), array(), '', false);
-        $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $dataProviderMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class)
+            ->setMethods(array('getBackendLayout'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backendLayoutMock->expects($this->any())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
         $dataProviderMock->expects($this->once())->method('getBackendLayout')->will($this->returnValue($backendLayoutMock));
 
@@ -85,8 +91,14 @@ class DataProviderCollectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $dataProviderIdentifier = $this->getUniqueId('custom');
         $backendLayoutIdentifier = $this->getUniqueId('identifier');
 
-        $dataProviderMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class, array('getBackendLayout'), array(), '', false);
-        $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, array('getIdentifier'), array(), '', false);
+        $dataProviderMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class)
+            ->setMethods(array('getBackendLayout'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
+            ->setMethods(array('getIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backendLayoutMock->expects($this->any())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
         $dataProviderMock->expects($this->once())->method('getBackendLayout')->will($this->returnValue($backendLayoutMock));
 
index b466636..5739345 100644 (file)
@@ -26,8 +26,8 @@ class HistoryEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     protected function setUp()
     {
-        $this->querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
-        $this->objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $this->querySettings = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->getMock();
+        $this->objectManager = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
         $this->objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($this->querySettings));
     }
 
@@ -37,7 +37,10 @@ class HistoryEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function initializeObjectSetsRespectStoragePidToFalse()
     {
         $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
-        $fixture = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository::class, array('setDefaultQuerySettings'), array($this->objectManager));
+        $fixture = $this->getMockBuilder(\TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository::class)
+            ->setMethods(array('setDefaultQuerySettings'))
+            ->setConstructorArgs(array($this->objectManager))
+            ->getMock();
         $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
         $fixture->initializeObject();
     }
index 14d0798..2f5a677 100644 (file)
@@ -25,13 +25,16 @@ class LogEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function initializeObjectSetsRespectStoragePidToFalse()
     {
         /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings $querySettings */
-        $querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
-        $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $querySettings = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->getMock();
+        $objectManager = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
         $objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings));
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
         /** @var \TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository::class, array('setDefaultQuerySettings'), array($objectManager));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository::class)
+            ->setMethods(array('setDefaultQuerySettings'))
+            ->setConstructorArgs(array($objectManager))
+            ->getMock();
         $subject->expects($this->once())->method('setDefaultQuerySettings')->with($querySettings);
         $subject->initializeObject();
     }
index ef9961a..69274eb 100644 (file)
@@ -24,11 +24,14 @@ class WorkspaceRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function initializeObjectSetsRespectStoragePidToFalse()
     {
-        $querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
-        $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $querySettings = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->getMock();
+        $objectManager = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
         $objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings));
         $querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
-        $subject = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository::class, array('setDefaultQuerySettings'), array($objectManager));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository::class)
+            ->setMethods(array('setDefaultQuerySettings'))
+            ->setConstructorArgs(array($objectManager))
+            ->getMock();
         $subject->expects($this->once())->method('setDefaultQuerySettings')->with($querySettings);
         $subject->initializeObject();
     }
index ab4adba..aa5324a 100644 (file)
@@ -24,7 +24,7 @@ class BackendUserRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function classCanBeInstantiated()
     {
-        $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class, array(), array(), '', false);
+        $objectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
         new \TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository($objectManager);
     }
 }
index 70adc69..398d20e 100644 (file)
@@ -24,7 +24,7 @@ class BackendUserSessionRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
      */
     public function classCanBeInstantiated()
     {
-        $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $objectManager = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
         new \TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository($objectManager);
     }
 }
index df29dce..0e7aec5 100644 (file)
@@ -26,17 +26,17 @@ class ModuleDataStorageServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         // The test calls several static dependencies that can not be mocked and
         // call database in the end, so we need to mock the database here.
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
 
         // Simulate empty module data
-        $GLOBALS['BE_USER'] = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', false);
+        $GLOBALS['BE_USER'] = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $GLOBALS['BE_USER']->uc = array();
         $GLOBALS['BE_USER']->uc['moduleData'] = array();
 
         /** @var \TYPO3\CMS\Beuser\Service\ModuleDataStorageService $subject */
         $subject = $this->getAccessibleMock(\TYPO3\CMS\Beuser\Service\ModuleDataStorageService::class, array('dummy'), array(), '', false);
-        $objectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class, array(), array(), '', false);
-        $moduleDataMock = $this->getMock(\TYPO3\CMS\Beuser\Domain\Model\ModuleData::class, array(), array(), '', false);
+        $objectManagerMock = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        $moduleDataMock = $this->createMock(\TYPO3\CMS\Beuser\Domain\Model\ModuleData::class);
         $objectManagerMock
             ->expects($this->once())
             ->method('get')
index 9f0f535..fafb641 100644 (file)
@@ -63,15 +63,24 @@ abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
             throw new \InvalidArgumentException('$originalClassName must not be empty.', 1334701880);
         }
 
-        return $this->getMock(
-            $this->buildAccessibleProxy($originalClassName),
-            $methods,
-            $arguments,
-            $mockClassName,
-            $callOriginalConstructor,
-            $callOriginalClone,
-            $callAutoload
-        );
+        $mockBuilder = $this->getMockBuilder($this->buildAccessibleProxy($originalClassName))
+            ->setMethods($methods)
+            ->setConstructorArgs($arguments)
+            ->setMockClassName($mockClassName);
+
+        if (!$callOriginalConstructor) {
+            $mockBuilder->disableOriginalConstructor();
+        }
+
+        if (!$callOriginalClone) {
+            $mockBuilder->disableOriginalClone();
+        }
+
+        if (!$callAutoload) {
+            $mockBuilder->disableAutoload();
+        }
+
+        return $mockBuilder->getMock();
     }
 
     /**
index b49bbc1..c75b647 100644 (file)
@@ -54,7 +54,9 @@ class AbstractUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         GeneralUtility::addInstance(ConnectionPool::class, $connectionPool->reveal());
 
         /** @var $mock \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication */
-        $mock = $this->getMock(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class, array('dummy'));
+        $mock = $this->getMockBuilder(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class)
+            ->setMethods(array('dummy'))
+            ->getMock();
         $mock->checkPid = true;
         $mock->checkPid_value = null;
         $mock->user_table = 'be_users';
index e5ecd27..5f5f741 100644 (file)
@@ -94,12 +94,15 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         );
 
         // logoff() call the static factory that has a dependency to a valid BE_USER object. Mock this away
-        $GLOBALS['BE_USER'] = $this->getMock(BackendUserAuthentication::class, array(), array(), '', false);
+        $GLOBALS['BE_USER'] = $this->createMock(BackendUserAuthentication::class);
         $GLOBALS['BE_USER']->user = array('uid' => $this->getUniqueId());
-        $GLOBALS['TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(DatabaseConnection::class);
 
         /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(BackendUserAuthentication::class, array('dummy'), array(), '', false);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject->logoff();
     }
 
@@ -250,7 +253,10 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getTSConfigReturnsCorrectArrayForGivenObjectString(array $completeConfiguration, $objectString, array $expectedConfiguration)
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('dummy'), array(), '', false);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject->userTS = $completeConfiguration;
 
         $actualConfiguration = $subject->getTSConfig($objectString);
@@ -316,7 +322,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilePermissionsTakesUserDefaultPermissionsFromTsConfigIntoAccountIfUserIsNotAdmin(array $userTsConfiguration)
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('isAdmin'));
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('isAdmin'))
+            ->getMock();
 
         $subject
             ->expects($this->any())
@@ -451,8 +459,10 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilePermissionsFromStorageOverwritesDefaultPermissions(array $defaultPermissions, $storageUid, array $storagePermissions, array $expectedPermissions)
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('isAdmin', 'getFilePermissions'));
-        $storageMock = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('isAdmin', 'getFilePermissions'))
+            ->getMock();
+        $storageMock = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $storageMock->expects($this->any())->method('getUid')->will($this->returnValue($storageUid));
 
         $subject
@@ -487,8 +497,10 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilePermissionsFromStorageAlwaysReturnsDefaultPermissionsForAdmins(array $defaultPermissions, $storageUid, array $storagePermissions)
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('isAdmin', 'getFilePermissions'));
-        $storageMock = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('isAdmin', 'getFilePermissions'))
+            ->getMock();
+        $storageMock = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $storageMock->expects($this->any())->method('getUid')->will($this->returnValue($storageUid));
 
         $subject
@@ -629,7 +641,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdmin($permissionValue, $expectedPermissions)
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('isAdmin'));
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('isAdmin'))
+            ->getMock();
 
         $subject
             ->expects($this->any())
@@ -646,7 +660,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilePermissionsGrantsAllPermissionsToAdminUsers()
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, array('isAdmin'));
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(array('isAdmin'))
+            ->getMock();
 
         $subject
             ->expects($this->any())
@@ -679,7 +695,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function jsConfirmationReturnsTrueIfPassedValueEqualsConfiguration()
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, ['getTSConfig']);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['getTSConfig'])
+            ->getMock();
         $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 1]);
 
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
@@ -691,7 +709,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function jsConfirmationAllowsSettingMultipleBitsInValue()
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, ['getTSConfig']);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['getTSConfig'])
+            ->getMock();
         $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 3]);
 
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
@@ -703,7 +723,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function jsConfirmationAlwaysReturnsFalseIfNoConfirmationIsSet()
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, ['getTSConfig']);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['getTSConfig'])
+            ->getMock();
         $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 0]);
 
         $this->assertFalse($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
@@ -715,7 +737,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function jsConfirmationReturnsTrueIfConfigurationIsMissing()
     {
-        $subject = $this->getMock(BackendUserAuthentication::class, ['getTSConfig']);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['getTSConfig'])
+            ->getMock();
 
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
     }
@@ -798,7 +822,9 @@ class BackendUserAuthenticationTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         }
 
         /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(BackendUserAuthentication::class, ['isAdmin']);
+        $subject = $this->getMockBuilder(BackendUserAuthentication::class)
+            ->setMethods(['isAdmin'])
+            ->getMock();
         $subject->expects($this->any())
             ->method('isAdmin')
             ->will($this->returnValue($admin));
index 344abe6..19e8046 100644 (file)
@@ -146,17 +146,16 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setCacheIsSettingIdentifierPrefixWithCacheIdentifier()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cacheMock */
-        $cacheMock = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cacheMock = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $cacheMock->expects($this->any())->method('getIdentifier')->will($this->returnValue(
             'testidentifier'
         ));
 
         /** @var $backendMock \PHPUnit_Framework_MockObject_MockObject|ApcBackend */
-        $backendMock = $this->getMock(
-            ApcBackend::class,
-            array('setIdentifierPrefix', 'getCurrentUserData', 'getPathSite'),
-            array('testcontext')
-        );
+        $backendMock = $this->getMockBuilder(ApcBackend::class)
+            ->setMethods(array('setIdentifierPrefix', 'getCurrentUserData', 'getPathSite'))
+            ->setConstructorArgs(array('testcontext'))
+            ->getMock();
 
         $backendMock->expects($this->once())->method('getCurrentUserData')->will(
             $this->returnValue(array('name' => 'testname'))
@@ -231,13 +230,13 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushRemovesOnlyOwnEntries()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thisCache */
-        $thisCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = new ApcBackend('Testing');
         $thisBackend->setCache($thisCache);
 
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thatCache */
-        $thatCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = new ApcBackend('Testing');
         $thatBackend->setCache($thatCache);
@@ -294,7 +293,7 @@ class ApcBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function setUpBackend($accessible = false)
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         if ($accessible) {
             $accessibleClassName = $this->buildAccessibleProxy(ApcBackend::class);
             $backend = new $accessibleClassName('Testing');
index 8a3822c..a7b805c 100644 (file)
@@ -49,9 +49,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\TYPO3\CMS\Core\Cache\Exception::class);
         $this->expectExceptionCode(1303669848);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('http://localhost/');
 
         $backend->setCache($mockCache);
@@ -158,10 +161,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getCacheDirectoryReturnsTheCurrentCacheDirectory()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('SomeCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -173,10 +179,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function aDedicatedCacheDirectoryIsUsedForCodeCaches()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class);
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('SomeCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -191,9 +200,12 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(InvalidDataException::class);
         $this->expectExceptionCode(1204481674);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -205,14 +217,17 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setReallySavesToTheSpecifiedDirectory()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileTest';
         $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -228,14 +243,17 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setOverwritesAnAlreadyExistingCacheEntryForTheSameIdentifier()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $data1 = 'some data' . microtime();
         $data2 = 'some data' . microtime();
         $entryIdentifier = 'BackendFileRemoveBeforeSetTest';
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -253,13 +271,16 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setAlsoSavesSpecifiedTags()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileRemoveBeforeSetTest';
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -276,13 +297,16 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setCacheDetectsAndLoadsAFrozenCache()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileTest';
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -292,7 +316,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
         unset($backend);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -305,10 +332,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getReturnsContentOfTheCorrectCacheFile()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('setTag'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('setTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -329,10 +359,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getReturnsFalseForExpiredEntries()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('isCacheFileExpired')->with('vfs://Foo/Cache/Data/UnitTestCache/ExpiredEntry')->will($this->returnValue(true));
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
@@ -345,10 +378,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getDoesNotCheckIfAnEntryIsExpiredIfTheCacheIsFrozen()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -365,10 +401,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasReturnsTrueIfAnEntryExists()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -386,7 +425,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasReturnsFalseForExpiredEntries()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->exactly(2))->method('isCacheFileExpired')->will($this->onConsecutiveCalls(true, false));
 
         $this->assertFalse($backend->has('foo'));
@@ -398,10 +440,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasDoesNotCheckIfAnEntryIsExpiredIfTheCacheIsFrozen()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -418,14 +463,17 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function removeReallyRemovesACacheEntry()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
         $data = 'some data' . microtime();
         $entryIdentifier = 'BackendFileTest';
         $pathAndFilename = 'vfs://Foo/Cache/Data/UnitTestCache/' . $entryIdentifier;
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -465,10 +513,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1282073032);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array('test'), '', true);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('test'))
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -484,10 +535,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1282073033);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -503,7 +557,11 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1282073034);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
+
         $backend->has($identifier);
     }
 
@@ -516,10 +574,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1282073035);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -535,10 +596,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1282073036);
 
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -550,10 +614,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function requireOnceIncludesAndReturnsResultOfIncludedPhpFile()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -571,10 +638,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function requireOnceDoesNotCheckExpiryTimeIfBackendIsFrozen()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -594,10 +664,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function findIdentifiersByTagFindsCacheEntriesWithSpecifiedTag()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -618,10 +691,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function findIdentifiersByTagDoesNotReturnExpiredEntries()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -639,10 +715,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushRemovesAllCacheEntries()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -664,10 +743,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushCreatesCacheDirectoryAgain()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
@@ -680,7 +762,10 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushByTagRemovesCacheEntriesWithSpecifiedTag()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('findIdentifiersByTag', 'remove'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('findIdentifiersByTag', 'remove'))
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $backend->expects($this->once())->method('findIdentifiersByTag')->with('UnitTestTag%special')->will($this->returnValue(array('foo', 'bar', 'baz')));
         $backend->expects($this->at(1))->method('remove')->with('foo');
@@ -695,10 +780,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function collectGarbageRemovesExpiredCacheEntries()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('isCacheFileExpired'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('isCacheFileExpired'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->exactly(2))->method('isCacheFileExpired')->will($this->onConsecutiveCalls(true, false));
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
@@ -720,10 +808,13 @@ class FileBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushUnfreezesTheCache()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, array('dummy'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->setCacheDirectory('vfs://Foo/');
         $backend->setCache($mockCache);
 
index 9fd2bea..83ebb5d 100644 (file)
@@ -215,14 +215,14 @@ class MemcachedBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $backendOptions = array('servers' => array('localhost:11211'));
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thisCache */
-        $thisCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = new MemcachedBackend('Testing', $backendOptions);
         $thisBackend->setCache($thisCache);
         $thisBackend->initializeObject();
 
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thatCache */
-        $thatCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = new MemcachedBackend('Testing', $backendOptions);
         $thatBackend->setCache($thatCache);
@@ -282,7 +282,7 @@ class MemcachedBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function setUpBackend(array $backendOptions = array(), $accessible = false)
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         if ($backendOptions == array()) {
             $backendOptions = array('servers' => array('localhost:11211'));
         }
index 11cab0a..cc19e9c 100644 (file)
@@ -197,11 +197,11 @@ class PdoBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushRemovesOnlyOwnEntries()
     {
-        $thisCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = $this->setUpBackend();
         $thisBackend->setCache($thisCache);
-        $thatCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = $this->setUpBackend();
         $thatBackend->setCache($thatCache);
@@ -258,7 +258,7 @@ class PdoBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUpBackend()
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache'));
         $backend = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\Backend\PdoBackend::class, 'Testing');
         $backend->setCache($mockCache);
index 9606124..bf4b578 100644 (file)
@@ -68,7 +68,7 @@ class RedisBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUpBackend(array $backendOptions = array())
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache'));
         $this->backend = new \TYPO3\CMS\Core\Cache\Backend\RedisBackend('Testing', $backendOptions);
         $this->backend->setCache($mockCache);
index a2ec6da..d795ef4 100644 (file)
@@ -40,7 +40,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function itIsPossibleToSetAndCheckExistenceInCache()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'Some data';
@@ -55,7 +55,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function itIsPossibleToSetAndGetEntry()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'Some data';
@@ -70,7 +70,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function itIsPossibleToRemoveEntryFromCache()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'Some data';
@@ -86,7 +86,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function itIsPossibleToOverwriteAnEntryInTheCache()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'Some data';
@@ -103,7 +103,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function findIdentifiersByTagFindsCacheEntriesWithSpecifiedTag()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'Some data';
@@ -120,7 +120,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasReturnsFalseIfTheEntryDoesntExist()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $identifier = 'NonExistingIdentifier';
@@ -133,7 +133,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function removeReturnsFalseIfTheEntryDoesntExist()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $identifier = 'NonExistingIdentifier';
@@ -146,7 +146,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushByTagRemovesCacheEntriesWithSpecifiedTag()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'some data' . microtime();
@@ -164,7 +164,7 @@ class TransientMemoryBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function flushRemovesAllCacheEntries()
     {
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $backend = new \TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend('Testing');
         $backend->setCache($cache);
         $data = 'some data' . microtime();
index 65ed048..f1db2c0 100644 (file)
@@ -33,7 +33,7 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUpMockFrontendOfBackend(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend $backend)
     {
-        $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), array(), '', false);
+        $mockCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class);
         $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('Testing'));
         $backend->setCache($mockCache);
         return $mockCache;
@@ -45,7 +45,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setCacheCalculatesCacheTableName()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
         $this->assertEquals('cf_Testing', $backend->getCacheTable());
     }
@@ -56,7 +59,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setCacheCalculatesTagsTableName()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
         $this->assertEquals('cf_Testing_tags', $backend->getTagsTable());
     }
@@ -70,7 +76,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->set('identifier', 'data');
     }
 
@@ -83,7 +92,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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'));
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
         $data = array('Some data');
         $entryIdentifier = 'BackendDbTest';
@@ -96,9 +108,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setInsertsEntryInTable()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_INSERTquery')
@@ -120,9 +135,12 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setRemovesAnAlreadyExistingCacheEntryForTheSameIdentifier()
     {
         /** @var \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend|\PHPUnit_Framework_MockObject_MockObject $backend */
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('remove'), array('Testing'));
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('remove'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
 
         $backend->expects($this->once())->method('remove');
         $data = $this->getUniqueId('someData');
@@ -136,11 +154,14 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setReallySavesSpecifiedTags()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
-        $connectionPool = $this->getMock(ConnectionPool::class);
-        $connection = $this->getMock(Connection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+        $connectionPool = $this->createMock(ConnectionPool::class);
+        $connection = $this->createMock(Connection::class);
         $connectionPool->expects($this->once())->method('getConnectionForTable')->willReturn($connection);
         $connection->expects($this->once())->method('bulkInsert')->with(
             'cf_Testing_tags',
@@ -173,14 +194,14 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'compression' => true
         );
         /** @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', $backendOptions)
-        );
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing', $backendOptions))
+            ->getMock();
+
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_INSERTquery')
@@ -203,10 +224,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setWithUnlimitedLifetimeWritesCorrectEntry()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_INSERTquery')
@@ -233,7 +257,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->get('identifier');
     }
 
@@ -243,10 +270,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function getReturnsContentOfTheCorrectCacheEntry()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_SELECTgetSingleRow')
@@ -263,10 +293,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function getSetsExceededLifetimeQueryPart()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_SELECTgetSingleRow')
@@ -288,7 +321,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->has('identifier');
     }
 
@@ -298,10 +334,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function hasReturnsTrueForExistingEntry()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_SELECTcountRows')
@@ -317,10 +356,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function hasSetsExceededLifetimeQueryPart()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->once())
             ->method('exec_SELECTcountRows')
@@ -342,7 +384,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->remove('identifier');
     }
 
@@ -352,10 +397,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function removeReallyRemovesACacheEntry()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->at(0))
             ->method('fullQuoteStr')
@@ -385,7 +433,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->collectGarbage();
     }
 
@@ -395,10 +446,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function collectGarbageDeletesTagsFromExpiredEntries()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->at(1))
             ->method('sql_fetch_assoc')
@@ -425,10 +479,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function collectGarbageDeletesExpiredEntry()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->at(1))
             ->method('sql_fetch_assoc')
@@ -450,7 +507,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->findIdentifiersByTag('identifier');
     }
 
@@ -460,10 +520,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function findIdentifiersByTagFindsCacheEntriesWithSpecifiedTag()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->at(0))
             ->method('fullQuoteStr')
@@ -490,7 +553,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->flush();
     }
 
@@ -500,7 +566,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushRemovesAllCacheEntries()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
         $connectionProphet = $this->prophesize(Connection::class);
@@ -526,7 +595,10 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $backend->flushByTag(array());
     }
 
@@ -536,10 +608,13 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushByTagRemovesCacheEntriesWithSpecifiedTag()
     {
         /** @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 = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class)
+            ->setMethods(array('dummy'))
+            ->setConstructorArgs(array('Testing'))
+            ->getMock();
         $this->setUpMockFrontendOfBackend($backend);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']
             ->expects($this->at(0))
             ->method('fullQuoteStr')
index 2cacdb7..34d47c1 100644 (file)
@@ -191,13 +191,13 @@ class WincacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushRemovesOnlyOwnEntries()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thisCache */
-        $thisCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = new WincacheBackend('Testing');
         $thisBackend->setCache($thisCache);
 
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thatCache */
-        $thatCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = new WincacheBackend('Testing');
         $thatBackend->setCache($thatCache);
@@ -254,7 +254,7 @@ class WincacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function setUpBackend($accessible = false)
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         if ($accessible) {
             $accessibleClassName = $this->buildAccessibleProxy(WincacheBackend::class);
             $backend = new $accessibleClassName('Testing');
index 49ac3e0..ea27df7 100644 (file)
@@ -194,13 +194,13 @@ class XcacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushRemovesOnlyOwnEntries()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thisCache */
-        $thisCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thisCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
         $thisBackend = new XcacheBackend('Testing');
         $thisBackend->setCache($thisCache);
 
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $thatCache */
-        $thatCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $thatCache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
         $thatBackend = new XcacheBackend('Testing');
         $thatBackend->setCache($thatCache);
@@ -257,7 +257,7 @@ class XcacheBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function setUpBackend($accessible = false)
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class, array(), array(), '', false);
+        $cache = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::class);
         if ($accessible) {
             $accessibleClassName = $this->buildAccessibleProxy(XcacheBackend::class);
             $backend = new $accessibleClassName('Testing');
index ea7b562..0ead78d 100644 (file)
@@ -26,7 +26,10 @@ class CacheFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function createReturnsInstanceOfTheSpecifiedCacheFrontend()
     {
-        $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array('registerCache'), array(), '', false);
+        $mockCacheManager = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\CacheManager::class)
+            ->setMethods(array('registerCache'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $factory = new \TYPO3\CMS\Core\Cache\CacheFactory('Testing', $mockCacheManager);
         $cache = $factory->create('TYPO3_Cache_FactoryTest_Cache', \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, \TYPO3\CMS\Core\Cache\Backend\NullBackend::class);
         $this->assertInstanceOf(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, $cache);
@@ -37,7 +40,10 @@ class CacheFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function createInjectsAnInstanceOfTheSpecifiedBackendIntoTheCacheFrontend()
     {
-        $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array('registerCache'), array(), '', false);
+        $mockCacheManager = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\CacheManager::class)
+            ->setMethods(array('registerCache'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $factory = new \TYPO3\CMS\Core\Cache\CacheFactory('Testing', $mockCacheManager);
         $cache = $factory->create('TYPO3_Cache_FactoryTest_Cache', \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, \TYPO3\CMS\Core\Cache\Backend\FileBackend::class);
         $this->assertInstanceOf(\TYPO3\CMS\Core\Cache\Backend\FileBackend::class, $cache->getBackend());
@@ -48,7 +54,10 @@ class CacheFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function createRegistersTheCacheAtTheCacheManager()
     {
-        $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array('registerCache'), array(), '', false);
+        $mockCacheManager = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\CacheManager::class)
+            ->setMethods(array('registerCache'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $mockCacheManager->expects($this->once())->method('registerCache');
         $factory = new \TYPO3\CMS\Core\Cache\CacheFactory('Testing', $mockCacheManager);
         $factory->create('TYPO3_Cache_FactoryTest_Cache', \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, \TYPO3\CMS\Core\Cache\Backend\FileBackend::class);
index 6ba219e..3773deb 100644 (file)
@@ -46,9 +46,15 @@ class CacheManagerTest extends UnitTestCase
         $this->expectExceptionCode(1203698223);
 
         $manager = new CacheManager();
-        $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache1 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('test'));
-        $cache2 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache2 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache2->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('test'));
         $manager->registerCache($cache1);
         $manager->registerCache($cache2);
@@ -60,9 +66,15 @@ class CacheManagerTest extends UnitTestCase
     public function managerReturnsThePreviouslyRegisteredCache()
     {
         $manager = new CacheManager();
-        $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache1 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache1'));
-        $cache2 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache2 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache2->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache2'));
         $manager->registerCache($cache1);
         $manager->registerCache($cache2);
@@ -78,7 +90,10 @@ class CacheManagerTest extends UnitTestCase
         $this->expectExceptionCode(1203699034);
 
         $manager = new CacheManager();
-        $cache = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('someidentifier'));
         $manager->registerCache($cache);
         $manager->getCache('someidentifier');
@@ -91,7 +106,10 @@ class CacheManagerTest extends UnitTestCase
     public function hasCacheReturnsCorrectResult()
     {
         $manager = new CacheManager();
-        $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache1 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache1'));
         $manager->registerCache($cache1);
         $this->assertTrue($manager->hasCache('cache1'), 'hasCache() did not return TRUE.');
@@ -104,11 +122,17 @@ class CacheManagerTest extends UnitTestCase
     public function flushCachesByTagCallsTheFlushByTagMethodOfAllRegisteredCaches()
     {
         $manager = new CacheManager();
-        $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache1 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache1'));
         $cache1->expects($this->once())->method('flushByTag')->with($this->equalTo('theTag'));
         $manager->registerCache($cache1);
-        $cache2 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache2 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache2->expects($this->once())->method('flushByTag')->with($this->equalTo('theTag'));
         $manager->registerCache($cache2);
         $manager->flushCachesByTag('theTag');
@@ -120,11 +144,17 @@ class CacheManagerTest extends UnitTestCase
     public function flushCachesCallsTheFlushMethodOfAllRegisteredCaches()
     {
         $manager = new CacheManager();
-        $cache1 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache1 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('cache1'));
         $cache1->expects($this->once())->method('flush');
         $manager->registerCache($cache1);
-        $cache2 = $this->getMock(AbstractFrontend::class, array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', false);
+        $cache2 = $this->getMockBuilder(AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache2->expects($this->once())->method('flush');
         $manager->registerCache($cache2);
         $manager->flushCaches();
index dc281f5..e9fa2fe 100644 (file)
@@ -26,9 +26,15 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function theConstructorAcceptsValidIdentifiers()
     {
-        $mockBackend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $mockBackend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         foreach (array('x', 'someValue', '123fivesixseveneight', 'some&', 'ab_cd%', rawurlencode('resource://some/äöü$&% sadf'), str_repeat('x', 250)) as $identifier) {
-            $abstractCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag', 'flush', 'flushByTag', 'collectGarbage'), array($identifier, $mockBackend));
+            $abstractCache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+                ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag', 'flush', 'flushByTag', 'collectGarbage'))
+                ->setConstructorArgs(array($identifier, $mockBackend))
+                ->getMock();
         }
     }
 
@@ -37,10 +43,16 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function theConstructorRejectsInvalidIdentifiers()
     {
-        $mockBackend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $mockBackend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         foreach (array('', 'abc def', 'foo!', 'bar:', 'some/', 'bla*', 'one+', 'äöü', str_repeat('x', 251), 'x$', '\\a', 'b#') as $identifier) {
             try {
-                $abstractCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag', 'flush', 'flushByTag', 'collectGarbage'), array($identifier, $mockBackend));
+                $abstractCache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+                    ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag', 'flush', 'flushByTag', 'collectGarbage'))
+                    ->setConstructorArgs(array($identifier, $mockBackend))
+                    ->getMock();
                 $this->fail('Identifier "' . $identifier . '" was not rejected.');
             } catch (\InvalidArgumentException $exception) {
             }
@@ -53,9 +65,15 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function flushCallsBackend()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('flush');
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         $cache->flush();
     }
 
@@ -68,9 +86,12 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectExceptionCode(1233057359);
 
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class);
         $backend->expects($this->never())->method('flushByTag');
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         $cache->flushByTag('SomeInvalid\\Tag');
     }
 
@@ -81,9 +102,15 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $tag = 'sometag';
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array('setCache', 'get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class)
+            ->setMethods(array('setCache', 'get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('flushByTag')->with($tag);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         $cache->flushByTag($tag);
     }
 
@@ -93,9 +120,15 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function collectGarbageCallsBackend()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('collectGarbage');
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         $cache->collectGarbage();
     }
 
@@ -105,8 +138,11 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function invalidEntryIdentifiersAreRecognizedAsInvalid()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array(), array(), '', false);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         foreach (array('', 'abc def', 'foo!', 'bar:', 'some/', 'bla*', 'one+', 'äöü', str_repeat('x', 251), 'x$', '\\a', 'b#') as $entryIdentifier) {
             $this->assertFalse($cache->isValidEntryIdentifier($entryIdentifier), 'Invalid identifier "' . $entryIdentifier . '" was not rejected.');
         }
@@ -118,8 +154,11 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function validEntryIdentifiersAreRecognizedAsValid()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array(), array(), '', false);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         foreach (array('_', 'abcdef', 'foo', 'bar123', '3some', '_bl_a', 'some&', 'one%TWO', str_repeat('x', 250)) as $entryIdentifier) {
             $this->assertTrue($cache->isValidEntryIdentifier($entryIdentifier), 'Valid identifier "' . $entryIdentifier . '" was not accepted.');
         }
@@ -131,8 +170,11 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function invalidTagsAreRecognizedAsInvalid()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array(), array(), '', false);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         foreach (array('', 'abc def', 'foo!', 'bar:', 'some/', 'bla*', 'one+', 'äöü', str_repeat('x', 251), 'x$', '\\a', 'b#') as $tag) {
             $this->assertFalse($cache->isValidTag($tag), 'Invalid tag "' . $tag . '" was not rejected.');
         }
@@ -144,8 +186,11 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function validTagsAreRecognizedAsValid()
     {
         $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array(), array(), '', false);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'))
+            ->setConstructorArgs(array($identifier, $backend))
+            ->getMock();
         foreach (array('abcdef', 'foo-bar', 'foo_baar', 'bar123', '3some', 'file%Thing', 'some&', '%x%', str_repeat('x', 250)) as $tag) {
             $this->assertTrue($cache->isValidTag($tag), 'Valid tag "' . $tag . '" was not accepted.');
         }
index 423febc..6b6ffa4 100644 (file)
@@ -30,7 +30,10 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1233057566);
 
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('isValidEntryIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
     }
@@ -42,7 +45,7 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $originalSourceCode = 'return "hello world!";';
         $modifiedSourceCode = '<?php' . chr(10) . $originalSourceCode . chr(10) . '#';
-        $mockBackend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface::class, array(), array(), '', false);
+        $mockBackend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface::class);
         $mockBackend->expects($this->once())->method('set')->with('Foo-Bar', $modifiedSourceCode, array('tags'), 1234);
         $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, 'PhpFrontend', $mockBackend);
         $cache->set('Foo-Bar', $originalSourceCode, array('tags'), 1234);
@@ -56,7 +59,10 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(InvalidDataException::class);
         $this->expectExceptionCode(1264023824);
 
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array('dummy'), array(), '', false);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache->set('Foo-Bar', array());
     }
 
@@ -65,7 +71,7 @@ class PhpFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function requireOnceCallsTheBackendsRequireOnceMethod()
     {
-        $mockBackend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface::class, array(), array(), '', false);
+        $mockBackend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface::class);
         $mockBackend->expects($this->once())->method('requireOnce')->with('Foo-Bar')->will($this->returnValue('hello world!'));
         $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, 'PhpFrontend', $mockBackend);
         $result = $cache->requireOnce('Foo-Bar');
index 34bf348..b75efc0 100644 (file)
@@ -30,7 +30,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1233057566);
 
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('isValidEntryIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
     }
@@ -41,7 +44,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setPassesStringToBackend()
     {
         $theString = 'Just some value';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('set')->with($this->equalTo('StringCacheTest'), $this->equalTo($theString));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->set('StringCacheTest', $theString);
@@ -54,7 +60,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $theString = 'Just some value';
         $theLifetime = 1234;
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('set')->with($this->equalTo('StringCacheTest'), $this->equalTo($theString), $this->equalTo(array()), $this->equalTo($theLifetime));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->set('StringCacheTest', $theString, array(), $theLifetime);
@@ -68,7 +77,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $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);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->set('StringCacheTest', array());
     }
@@ -78,7 +90,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFetchesStringValueFromBackend()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('get')->will($this->returnValue('Just some value'));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $this->assertEquals('Just some value', $cache->get('StringCacheTest'), 'The returned value was not the expected string.');
@@ -89,7 +104,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasReturnsResultFromBackend()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('has')->with($this->equalTo('StringCacheTest'))->will($this->returnValue(true));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $this->assertTrue($cache->has('StringCacheTest'), 'has() did not return TRUE.');
@@ -101,7 +119,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function removeCallsBackend()
     {
         $cacheIdentifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('remove')->with($this->equalTo($cacheIdentifier))->will($this->returnValue(true));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $this->assertTrue($cache->remove($cacheIdentifier), 'remove() did not return TRUE');
@@ -115,7 +136,7 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1233057772);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class);
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
         $cache->getByTag('SomeInvalid\\Tag');
     }
@@ -128,7 +149,10 @@ class StringFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $tag = 'sometag';
         $identifiers = array('one', 'two');
         $entries = array('one value', 'two value');
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('findIdentifiersByTag')->with($this->equalTo($tag))->will($this->returnValue($identifiers));
         $backend->expects($this->exactly(2))->method('get')->will($this->onConsecutiveCalls('one value', 'two value'));
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\StringFrontend('StringFrontend', $backend);
index dd6c8ee..83b4afc 100644 (file)
@@ -29,7 +29,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1233057566);
 
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('isValidEntryIdentifier'), array(), '', false);
+        $cache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('isValidEntryIdentifier'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(false));
         $cache->set('foo', 'bar');
     }
@@ -40,7 +43,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setPassesSerializedStringToBackend()
     {
         $theString = 'Just some value';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('set')->with($this->equalTo('VariableCacheTest'), $this->equalTo(serialize($theString)));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -53,7 +59,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function setPassesSerializedArrayToBackend()
     {
         $theArray = array('Just some value', 'and another one.');
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('set')->with($this->equalTo('VariableCacheTest'), $this->equalTo(serialize($theArray)));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -67,7 +76,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $theString = 'Just some value';
         $theLifetime = 1234;
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('set')->with($this->equalTo('VariableCacheTest'), $this->equalTo(serialize($theString)), $this->equalTo(array()), $this->equalTo($theLifetime));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -79,7 +91,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFetchesStringValueFromBackend()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('get')->will($this->returnValue(serialize('Just some value')));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -92,7 +107,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function getFetchesArrayValueFromBackend()
     {
         $theArray = array('Just some value', 'and another one.');
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('get')->will($this->returnValue(serialize($theArray)));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -104,7 +122,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFetchesFalseBooleanValueFromBackend()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('get')->will($this->returnValue(serialize(false)));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -116,7 +137,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function hasReturnsResultFromBackend()
     {
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $backend->expects($this->once())->method('has')->with($this->equalTo('VariableCacheTest'))->will($this->returnValue(true));
 
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
@@ -129,7 +153,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function removeCallsBackend()
     {
         $cacheIdentifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $backend->expects($this->once())->method('remove')->with($this->equalTo($cacheIdentifier))->will($this->returnValue(true));
 
@@ -145,7 +172,7 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1233058312);
 
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class, array(), array(), '', false);
+        $backend = $this->createMock(\TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface::class);
         $cache = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('VariableFrontend', $backend);
         $cache->getByTag('SomeInvalid\Tag');
     }
@@ -158,7 +185,10 @@ class VariableFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $tag = 'sometag';
         $identifiers = array('one', 'two');
         $entries = array('one value', 'two value');
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
+        $backend = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class)
+            ->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $backend->expects($this->once())->method('findIdentifiersByTag')->with($this->equalTo($tag))->will($this->returnValue($identifiers));
         $backend->expects($this->exactly(2))->method('get')->will($this->onConsecutiveCalls(serialize('one value'), serialize('two value')));
index 030b67c..45035da 100644 (file)
@@ -49,11 +49,12 @@ class RecordCollectionRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->databaseMock = $this->getMock(
-            \TYPO3\CMS\Core\Database\DatabaseConnection::class,
-            array('exec_UPDATEquery', 'exec_SELECTgetSingleRow', 'exec_SELECTgetRows', 'fullQuoteStr')
-        );
-        $this->subject = $this->getMock(\TYPO3\CMS\Core\Collection\RecordCollectionRepository::class, array('getDatabaseConnection'));
+        $this->databaseMock = $this->getMockBuilder(\TYPO3\CMS\Core\Database\DatabaseConnection::class)
+            ->setMethods(array('exec_UPDATEquery', 'exec_SELECTgetSingleRow', 'exec_SELECTgetRows', 'fullQuoteStr'))
+            ->getMock();
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Collection\RecordCollectionRepository::class)
+            ->setMethods(array('getDatabaseConnection'))
+            ->getMock();
         $this->subject->expects($this->any())->method('getDatabaseConnection')->will($this->returnValue($this->databaseMock));
         $this->testTableName = $this->getUniqueId('tx_testtable');
     }
index 3b8c10b..1c2588c 100644 (file)
@@ -39,10 +39,9 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function createSubjectWithMockedMethods(array $methods)
     {
-        $this->subject = $this->getMock(
-            \TYPO3\CMS\Core\Configuration\ConfigurationManager::class,
-            $methods
-        );
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class)
+            ->setMethods($methods)
+            ->getMock();
     }
 
     /**
index 31d611f..33c56b3 100644 (file)
@@ -39,7 +39,9 @@ class FlexFormToolsTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         );
         $editData = '';
         /** @var \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(FlexFormTools::class, array('executeCallBackMethod'));
+        $subject = $this->getMockBuilder(FlexFormTools::class)
+            ->setMethods(array('executeCallBackMethod'))
+            ->getMock();
         $subject->expects($this->never())->method('executeCallBackMethod');
         $subject->traverseFlexFormXMLData_recurse($dataStruct, $editData, $pA);
     }
@@ -66,7 +68,7 @@ class FlexFormToolsTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         );
         $editData2 = '';
         /** @var \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(FlexFormTools::class);
+        $subject = $this->createMock(FlexFormTools::class);
         $this->assertEquals(
             $subject->traverseFlexFormXMLData_recurse($dataStruct, $editData, $pA),
             $subject->traverseFlexFormXMLData_recurse($dataStruct, $editData2, $pA)
index a6e2ce4..7c1aeba 100644 (file)
@@ -36,17 +36,14 @@ class BootstrapTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             '',
             false
         );
-        $mockCache = $this->getMock(
-            \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class,
-            array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'),
-            array(),
-            '',
-            false
-        );
-        $mockCacheManager = $this->getMock(
-            \TYPO3\CMS\Core\Cache\CacheManager::class,
-            array('getCache')
-        );
+        $mockCache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'))
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $mockCacheManager = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\CacheManager::class)
+            ->setMethods(array('getCache'))
+            ->getMock();
         $mockCacheManager
             ->expects($this->any())
             ->method('getCache')
@@ -75,17 +72,14 @@ class BootstrapTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             '',
             false
         );
-        $mockCache = $this->getMock(
-            \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class,
-            array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'),
-            array(),
-            '',
-            false
-        );
-        $mockCacheManager = $this->getMock(
-            \TYPO3\CMS\Core\Cache\CacheManager::class,
-            array('getCache')
-        );
+        $mockCache = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class)
+            ->setMethods(array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'))
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $mockCacheManager = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\CacheManager::class)
+            ->setMethods(array('getCache'))
+            ->getMock();
         $mockCacheManager
             ->expects($this->any())
             ->method('getCache')
index 350467c..5c03bb1 100644 (file)
@@ -43,7 +43,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
             ],
         ]);
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [], __DIR__);
         $generator->buildClassAliasMapForPackage($packageMock);
     }
@@ -66,7 +66,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
             ],
         ]);
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [], __DIR__);
         $generator->buildClassAliasMapForPackage($packageMock);
     }
@@ -92,7 +92,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
         ];
         $packageMock = $this->createPackageMock(array());
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [], __DIR__);
         $this->assertEquals($expectedClassMap, $generator->buildClassAliasMapForPackage($packageMock));
     }
@@ -126,7 +126,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
             ],
         ]);
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [], __DIR__);
         $this->assertEquals($expectedClassMap, $generator->buildClassAliasMapForPackage($packageMock));
     }
@@ -251,7 +251,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
     public function autoloadFilesAreBuildCorrectly($packageManifest, $expectedPsr4Files, $expectedClassMapFiles)
     {
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [$this->createPackageMock($packageManifest)], __DIR__);
         $files = $generator->buildAutoloadInformationFiles();
 
@@ -361,7 +361,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
     public function autoloadDevFilesAreBuildCorrectly($packageManifest, $expectedPsr4Files, $expectedClassMapFiles)
     {
         /** @var ClassLoader|\PHPUnit_Framework_MockObject_MockObject $classLoaderMock */
-        $classLoaderMock = $this->getMock(ClassLoader::class);
+        $classLoaderMock = $this->createMock(ClassLoader::class);
         $generator = new ClassLoadingInformationGenerator($classLoaderMock, [$this->createPackageMock($packageManifest)], __DIR__, true);
         $files = $generator->buildAutoloadInformationFiles();
 
@@ -391,7 +391,7 @@ class ClassLoadingInformationGeneratorTest extends UnitTestCase
      */
     protected function createPackageMock($packageManifest)
     {
-        $packageMock = $this->getMock(PackageInterface::class);
+        $packageMock = $this->createMock(PackageInterface::class);
         $packageMock->expects($this->any())->method('getPackagePath')->willReturn(__DIR__ . '/Fixtures/test_extension/');
         $packageMock->expects($this->any())->method('getValueFromComposerManifest')->willReturn(
             json_decode(json_encode($packageManifest))
index 3405d69..3b602f9 100644 (file)
@@ -54,8 +54,8 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $GLOBALS['TCA'] = array();
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
-        $this->backEndUser = $this->getMock(BackendUserAuthentication::class);
-        $this->mockDatabaseConnection = $this->getMock(DatabaseConnection::class, array(), array(), '', false);
+        $this->backEndUser = $this->createMock(BackendUserAuthentication::class);
+        $this->mockDatabaseConnection = $this->createMock(DatabaseConnection::class);
         $GLOBALS['TYPO3_DB'] = $this->mockDatabaseConnection;
         $this->subject = $this->getAccessibleMock(DataHandler::class, ['dummy']);
         $this->subject->start(array(), '', $this->backEndUser);
@@ -359,7 +359,10 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function doesCheckModifyAccessListHookGetsCalled()
     {
         $hookClass = $this->getUniqueId('tx_coretest');
-        $hookMock = $this->getMock(\TYPO3\CMS\Core\DataHandling\DataHandlerCheckModifyAccessListHookInterface::class, array('checkModifyAccessList'), array(), $hookClass);
+        $hookMock = $this->getMockBuilder(\TYPO3\CMS\Core\DataHandling\DataHandlerCheckModifyAccessListHookInterface::class)
+            ->setMethods(array('checkModifyAccessList'))
+            ->setMockClassName($hookClass)
+            ->getMock();
         $hookMock->expects($this->once())->method('checkModifyAccessList');
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = $hookClass;
         GeneralUtility::addInstance($hookClass, $hookMock);
@@ -386,7 +389,9 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function processDatamapForFrozenNonZeroWorkspaceReturnsFalse()
     {
         /** @var DataHandler $subject */
-        $subject = $this->getMock(DataHandler::class, array('newlog'));
+        $subject = $this->getMockBuilder(DataHandler::class)
+            ->setMethods(array('newlog'))
+            ->getMock();
         $this->backEndUser->workspace = 1;
         $this->backEndUser->workspaceRec = array('freeze' => true);
         $subject->BE_USER = $this->backEndUser;
@@ -409,10 +414,9 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         );
 
         /** @var $subject DataHandler|\PHPUnit_Framework_MockObject_MockObject */
-        $subject = $this->getMock(
-            DataHandler::class,
-            array('newlog', 'checkModifyAccessList', 'tableReadOnly', 'checkRecordUpdateAccess')
-        );
+        $subject = $this->getMockBuilder(DataHandler::class)
+            ->setMethods(array('newlog', 'checkModifyAccessList', 'tableReadOnly', 'checkRecordUpdateAccess'))
+            ->getMock();
 
         $subject->bypassWorkspaceRestrictions = false;
         $subject->datamap = array(
@@ -427,14 +431,14 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $subject->expects($this->once())->method('checkRecordUpdateAccess')->will($this->returnValue(true));
 
         /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $backEndUser */
-        $backEndUser = $this->getMock(BackendUserAuthentication::class);
+        $backEndUser = $this->createMock(BackendUserAuthentication::class);
         $backEndUser->workspace = 1;
         $backEndUser->workspaceRec = array('freeze' => false);
         $backEndUser->expects($this->once())->method('workspaceAllowAutoCreation')->will($this->returnValue(true));
         $backEndUser->expects($this->once())->method('workspaceCannotEditRecord')->will($this->returnValue(true));
         $backEndUser->expects($this->once())->method('recordEditAccessInternals')->with('pages', 1)->will($this->returnValue(true));
         $subject->BE_USER = $backEndUser;
-        $createdTceMain = $this->getMock(DataHandler::class, array());
+        $createdTceMain = $this->createMock(DataHandler::class);
         $createdTceMain->expects($this->once())->method('start')->with(array(), array(
             'pages' => array(
                 1 => array(
@@ -458,7 +462,9 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function doesCheckFlexFormValueHookGetsCalled()
     {
         $hookClass = $this->getUniqueId('tx_coretest');
-        $hookMock = $this->getMock($hookClass, array('checkFlexFormValue_beforeMerge'));
+        $hookMock = $this->getMockBuilder($hookClass)
+            ->setMethods(array('checkFlexFormValue_beforeMerge'))
+            ->getMock();
         $hookMock->expects($this->once())->method('checkFlexFormValue_beforeMerge');
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkFlexFormValue'][] = $hookClass;
         GeneralUtility::addInstance($hookClass, $hookMock);
@@ -473,7 +479,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function logCallsWriteLogOfBackendUserIfLoggingIsEnabled()
     {
-        $backendUser = $this->getMock(BackendUserAuthentication::class);
+        $backendUser = $this->createMock(BackendUserAuthentication::class);
         $backendUser->expects($this->once())->method('writelog');
         $this->subject->enableLogging = true;
         $this->subject->BE_USER = $backendUser;
@@ -485,7 +491,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function logDoesNotCallWriteLogOfBackendUserIfLoggingIsDisabled()
     {
-        $backendUser = $this->getMock(BackendUserAuthentication::class);
+        $backendUser = $this->createMock(BackendUserAuthentication::class);
         $backendUser->expects($this->never())->method('writelog');
         $this->subject->enableLogging = false;
         $this->subject->BE_USER = $backendUser;
@@ -497,7 +503,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function logAddsEntryToLocalErrorLogArray()
     {
-        $backendUser = $this->getMock(BackendUserAuthentication::class);
+        $backendUser = $this->createMock(BackendUserAuthentication::class);
         $this->subject->BE_USER = $backendUser;
         $this->subject->enableLogging = true;
         $this->subject->errorLog = array();
@@ -511,7 +517,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function logFormatsDetailMessageWithAdditionalDataInLocalErrorArray()
     {
-        $backendUser = $this->getMock(BackendUserAuthentication::class);
+        $backendUser = $this->createMock(BackendUserAuthentication::class);
         $this->subject->BE_USER = $backendUser;
         $this->subject->enableLogging = true;
         $this->subject->errorLog = array();
@@ -738,7 +744,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             array('dummy')
         );
 
-        $backendUser = $this->getMock(BackendUserAuthentication::class);
+        $backendUser = $this->createMock(BackendUserAuthentication::class);
         $subject->BE_USER = $backendUser;
         $subject->BE_USER->workspace = 1;
 
@@ -786,7 +792,9 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function deletePagesOnRootLevelIsDenied()
     {
         /** @var DataHandler|\PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface $dataHandlerMock */
-        $dataHandlerMock = $this->getMock(DataHandler::class, ['canDeletePage', 'newlog2']);
+        $dataHandlerMock = $this->getMockBuilder(DataHandler::class)
+            ->setMethods(['canDeletePage', 'newlog2'])
+            ->getMock();
         $dataHandlerMock
             ->expects($this->never())
             ->method('canDeletePage');
@@ -813,7 +821,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         );
 
         /** @var \TYPO3\CMS\Core\Database\RelationHandler $mockRelationHandler */
-        $mockRelationHandler = $this->getMock(\TYPO3\CMS\Core\Database\RelationHandler::class, array(), array(), '', false);
+        $mockRelationHandler = $this->createMock(\TYPO3\CMS\Core\Database\RelationHandler::class);
         $mockRelationHandler->itemArray = array(
             '1' => array('table' => $this->getUniqueId('bar_'), 'id' => 67)
         );
index 6d3f70f..702f44d 100644 (file)
@@ -391,9 +391,7 @@ class ConnectionTest extends UnitTestCase
      */
     public function selectQueries(array $args, string $expectedQuery, array $expectedParameters)
     {
-        $resultStatement = $this->getMockBuilder(Statement::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $resultStatement = $this->createMock(Statement::class);
 
         $this->connection->expects($this->once())
             ->method('executeQuery')
@@ -443,9 +441,7 @@ class ConnectionTest extends UnitTestCase
      */
     public function countQueries(array $args, string $expectedQuery, array $expectedParameters)
     {
-        $resultStatement = $this->getMockBuilder(Statement::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $resultStatement = $this->createMock(Statement::class);
 
         $resultStatement->expects($this->once())
             ->method('fetchColumn')
index acdac77..42dfd5c 100644 (file)
@@ -79,7 +79,7 @@ class DatabaseConnectionTest extends UnitTestCase
             ->will($this->returnCallback(function ($data) {
                 return $data;
             }));
-        $mysqliMock = $this->getMock('mysqli');
+        $mysqliMock = $this->createMock('mysqli');
         $mysqliMock
             ->expects($this->once())
             ->method('query')
@@ -106,7 +106,7 @@ class DatabaseConnectionTest extends UnitTestCase
             ->will($this->returnCallback(function ($data) {
                 return $data;
             }));
-        $mysqliMock = $this->getMock('mysqli');
+        $mysqliMock = $this->createMock('mysqli');
         $mysqliMock
             ->expects($this->once())
             ->method('query')
@@ -233,7 +233,10 @@ class DatabaseConnectionTest extends UnitTestCase
     public function searchQueryCreatesQuery($expectedResult, array $searchWords, array $fields, $table, $constraint)
     {
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(DatabaseConnection::class, ['quoteStr'], [], '', false);
+        $subject = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['quoteStr'])
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject
             ->expects($this->any())
             ->method('quoteStr')
@@ -254,7 +257,10 @@ class DatabaseConnectionTest extends UnitTestCase
     public function escapeStringForLikeComparison()
     {
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(DatabaseConnection::class, ['dummy'], [], '', false);
+        $subject = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['dummy'])
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->assertEquals('foo\\_bar\\%', $subject->escapeStrForLike('foo_bar%', 'table'));
     }
 
@@ -320,7 +326,10 @@ class DatabaseConnectionTest extends UnitTestCase
     public function stripOrderByForOrderByKeyword($orderByClause, $expectedResult)
     {
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(DatabaseConnection::class, ['dummy'], [], '', false);
+        $subject = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['dummy'])
+            ->disableOriginalConstructor()
+            ->getMock();
         $strippedQuery = $subject->stripOrderBy($orderByClause);
         $this->assertEquals($expectedResult, $strippedQuery);
     }
@@ -387,7 +396,10 @@ class DatabaseConnectionTest extends UnitTestCase
     public function stripGroupByForGroupByKeyword($groupByClause, $expectedResult)
     {
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(DatabaseConnection::class, ['dummy'], [], '', false);
+        $subject = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['dummy'])
+            ->disableOriginalConstructor()
+            ->getMock();
         $strippedQuery = $subject->stripGroupBy($groupByClause);
         $this->assertEquals($expectedResult, $strippedQuery);
     }
@@ -541,13 +553,11 @@ class DatabaseConnectionTest extends UnitTestCase
     public function noQuoteForFullQuoteArray(array $input, array $expected, $noQuote)
     {
         /** @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface $subject */
-        $subject = $this->getMock(
-            DatabaseConnection::class,
-            ['fullQuoteStr'],
-            [],
-            '',
-            false
-        );
+        $subject = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['fullQuoteStr'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
         $subject
             ->expects($this->any())
             ->method('fullQuoteStr')
@@ -567,7 +577,7 @@ class DatabaseConnectionTest extends UnitTestCase
         $subject->_set('isConnected', true);
         $subject->_set('databaseName', $this->testTable);
 
-        $mysqliMock = $this->getMock('mysqli');
+        $mysqliMock = $this->getMockBuilder('mysqli')->getMock();
         $mysqliMock
             ->expects($this->once())
             ->method('select_db')
@@ -589,7 +599,7 @@ class DatabaseConnectionTest extends UnitTestCase
         $subject->_set('isConnected', true);
         $subject->_set('databaseName', $this->testTable);
 
-        $mysqliMock = $this->getMock('mysqli');
+        $mysqliMock = $this->getMockBuilder('mysqli')->getMock();
         $mysqliMock
             ->expects($this->once())
             ->method('select_db')
index 2cb78c4..79a17e1 100644 (file)
@@ -46,9 +46,7 @@ class BulkInsertTest extends UnitTestCase
     {
         parent::setUp();
 
-        $this->connection = $this->getMockBuilder(Connection::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $this->connection = $this->createMock(Connection::class);
 
         $this->connection->expects($this->any())
             ->method('quoteIdentifier')
index 0927168..c280b09 100644 (file)
@@ -161,7 +161,7 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
             )
         ];
 
-        $pageRepository = $this->getMock(PageRepository::class);
+        $pageRepository = $this->createMock(PageRepository::class);
         $pageRepository->versioningWorkspaceId = $workspaceId;
         $pageRepository->versioningPreview = $workspacePreview;
 
@@ -171,7 +171,9 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
         $typoScriptFrontendController->gr_list = $feGroupList;
         $typoScriptFrontendController->sys_page = $pageRepository;
 
-        $dbMock = $this->getMock(DatabaseConnection::class, ['quoteStr']);
+        $dbMock = $this->getMockBuilder(DatabaseConnection::class)
+            ->setMethods(['quoteStr'])
+            ->getMock();
         $dbMock->expects($this->any())->method('quoteStr')->willReturnArgument(0);
 
         $GLOBALS['TSFE'] = $typoScriptFrontendController;
index e7689f7..2844e79 100644 (file)
@@ -41,7 +41,7 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
             ]
         ];
 
-        $pageRepository = $this->getMock(PageRepository::class);
+        $pageRepository = $this->createMock(PageRepository::class);
         $pageRepository->versioningPreview = false;
 
         $subject = new FrontendWorkspaceRestriction(0);
@@ -62,7 +62,7 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
             ]
         ];
 
-        $pageRepository = $this->getMock(PageRepository::class);
+        $pageRepository = $this->createMock(PageRepository::class);
         $pageRepository->versioningPreview = true;
         $pageRepository->versioningWorkspaceId = 42;
 
@@ -84,7 +84,7 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase
             ]
         ];
 
-        $pageRepository = $this->getMock(PageRepository::class);
+        $pageRepository = $this->createMock(PageRepository::class);
         $pageRepository->versioningPreview = true;
         $pageRepository->versioningWorkspaceId = 42;
 
index 33056fe..8cc44cd 100644 (file)
@@ -29,7 +29,9 @@ class RelationHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->subject = $this->getMock(\TYPO3\CMS\Core\Database\RelationHandler::class, array('purgeVersionedIds', 'purgeLiveVersionedIds'));
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Database\RelationHandler::class)
+            ->setMethods(array('purgeVersionedIds', 'purgeLiveVersionedIds'))
+            ->getMock();
     }
 
     /**
index 82d8c7c..6ac5ae1 100644 (file)
@@ -29,7 +29,10 @@ class DebugExceptionHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->subject = $this->getMock(\TYPO3\CMS\Core\Error\DebugExceptionHandler::class, array('sendStatusHeaders', 'writeLogEntries'), array(), '', false);
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Error\DebugExceptionHandler::class)
+            ->setMethods(array('sendStatusHeaders', 'writeLogEntries'))
+            ->disableOriginalConstructor()
+            ->getMock();
     }
 
     /**
index 346627b..32ce57b 100644 (file)
@@ -29,7 +29,10 @@ class ProductionExceptionHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->subject = $this->getMock(\TYPO3\CMS\Core\Error\ProductionExceptionHandler::class, array('discloseExceptionInformation', 'sendStatusHeaders', 'writeLogEntries'), array(), '', false);
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Error\ProductionExceptionHandler::class)
+            ->setMethods(array('discloseExceptionInformation', 'sendStatusHeaders', 'writeLogEntries'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->subject->expects($this->any())->method('discloseExceptionInformation')->will($this->returnValue(true));
     }
 
@@ -55,7 +58,10 @@ class ProductionExceptionHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $title = '<b>b</b><script>alert(1);</script>';
         /** @var $exception \Exception|\PHPUnit_Framework_MockObject_MockObject */
-        $exception = $this->getMock('Exception', array('getTitle'), array('some message'));
+        $exception = $this->getMockBuilder('Exception')
+            ->setMethods(array('getTitle'))
+            ->setConstructorArgs(array('some message'))
+            ->getMock();
         $exception->expects($this->any())->method('getTitle')->will($this->returnValue($title));
         ob_start();
         $this->subject->echoExceptionWeb($exception);
index f9e6ee7..c72b81d 100644 (file)
@@ -37,7 +37,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function generateTokenRetrievesTokenOnce()
     {
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('retrieveSessionToken'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('retrieveSessionToken'))
+            ->getMock();
         $subject->expects($this->once())->method('retrieveSessionToken')->will($this->returnValue('token'));
         $subject->generateToken('foo');
         $subject->generateToken('foo');
@@ -48,7 +50,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function validateTokenRetrievesTokenOnce()
     {
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('retrieveSessionToken'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('retrieveSessionToken'))
+            ->getMock();
         $subject->expects($this->once())->method('retrieveSessionToken')->will($this->returnValue('token'));
         $subject->validateToken('foo', 'bar');
         $subject->validateToken('foo', 'bar');
@@ -70,7 +74,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function cleanPersistsToken()
     {
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('persistSessionToken'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('persistSessionToken'))
+            ->getMock();
         $subject->expects($this->once())->method('persistSessionToken');
         $subject->clean();
     }
@@ -234,7 +240,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function validateTokenForValidTokenNotCallsCreateValidationErrorMessage()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('createValidationErrorMessage'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('createValidationErrorMessage'))
+            ->getMock();
         $subject->expects($this->never())->method('createValidationErrorMessage');
         $formName = 'foo';
         $action = 'edit';
@@ -250,7 +258,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function validateTokenForInvalidTokenCallsCreateValidationErrorMessage()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('createValidationErrorMessage'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('createValidationErrorMessage'))
+            ->getMock();
         $subject->expects($this->once())->method('createValidationErrorMessage');
         $formName = 'foo';
         $action = 'edit';
@@ -266,7 +276,9 @@ class AbstractFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function validateTokenForInvalidFormNameCallsCreateValidationErrorMessage()
     {
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class, array('createValidationErrorMessage'));
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting::class)
+            ->setMethods(array('createValidationErrorMessage'))
+            ->getMock();
         $subject->expects($this->once())->method('createValidationErrorMessage');
         $formName = 'foo';
         $action = 'edit';
index d7fc0cd..371e06a 100644 (file)
@@ -43,9 +43,9 @@ class BackendFormProtectionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->backendUserMock = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
+        $this->backendUserMock = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $this->backendUserMock->user['uid'] = 1;
-        $this->registryMock = $this->getMock(Registry::class);
+        $this->registryMock = $this->createMock(Registry::class);
         $this->subject = new BackendFormProtection(
             $this->backendUserMock,
             $this->registryMock,
index f6aae7e..a8e8039 100644 (file)
@@ -62,14 +62,14 @@ class FormProtectionFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getForTypeBackEndWithExistingBackEndReturnsBackEndFormProtection()
     {
-        $userMock = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', false);
+        $userMock = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $userMock->user = array('uid' => $this->getUniqueId());
         $this->assertInstanceOf(
             \TYPO3\CMS\Core\FormProtection\BackendFormProtection::class,
             FormProtectionFactory::get(
                 \TYPO3\CMS\Core\FormProtection\BackendFormProtection::class,
                 $userMock,
-                $this->getMock(Registry::class)
+                $this->createMock(Registry::class)
             )
         );
     }
@@ -79,12 +79,12 @@ class FormProtectionFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getForTypeBackEndCalledTwoTimesReturnsTheSameInstance()
     {
-        $userMock = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', false);
+        $userMock = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
         $userMock->user = array('uid' => $this->getUniqueId());
         $arguments = [
             \TYPO3\CMS\Core\FormProtection\BackendFormProtection::class,
             $userMock,
-            $this->getMock(Registry::class)
+            $this->createMock(Registry::class)
         ];
         $this->assertSame(
             call_user_func_array([FormProtectionFactory::class, 'get'], $arguments),
@@ -144,19 +144,13 @@ class FormProtectionFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function createValidationErrorMessageAddsErrorFlashMessageButNotInSessionInAjaxRequest()
     {
-        $flashMessageQueueMock = $this->getMock(
-            \TYPO3\CMS\Core\Messaging\FlashMessageQueue::class,
-            array(),
-            array(),
-            '',
-            false
-        );
+        $flashMessageQueueMock = $this->createMock(\TYPO3\CMS\Core\Messaging\FlashMessageQueue::class);
         $flashMessageQueueMock
             ->expects($this->once())
             ->method('enqueue')
             ->with($this->isInstanceOf(\TYPO3\CMS\Core\Messaging\FlashMessage::class))
             ->will($this->returnCallback(array($this, 'enqueueAjaxFlashMessageCallback')));
-        $languageServiceMock = $this->getMock(\TYPO3\CMS\Lang\LanguageService::class, array(), array(), '', false);
+        $languageServiceMock = $this->createMock(\TYPO3\CMS\Lang\LanguageService::class);
         $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('foo'));
 
         FormProtectionFactory::getMessageClosure($languageServiceMock, $flashMessageQueueMock, true)->__invoke();
index 9622f9c..479d490 100644 (file)
@@ -529,8 +529,10 @@ class IconFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function getTestSubjectFileObject($extension, $mimeType = '')
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $mockedFile = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(array(), $mockedStorage));
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockedFile = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\File::class)
+            ->setConstructorArgs(array(array(), $mockedStorage))
+            ->getMock();
         $mockedFile->expects($this->atMost(1))->method('getExtension')->will($this->returnValue($extension));
         $mockedFile->expects($this->atLeastOnce())->method('getMimeType')->will($this->returnValue($mimeType));
         return $mockedFile;
@@ -544,7 +546,7 @@ class IconFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function getTestSubjectFolderObject($identifier)
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $mockedStorage->expects($this->any())->method('getRootLevelFolder')->will($this->returnValue(
             new \TYPO3\CMS\Core\Resource\Folder($mockedStorage, '/', '/')
         ));
index 4587ee1..9766000 100644 (file)
@@ -68,8 +68,13 @@ class LocalizationFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         /** @var $subject LocalizationFactory */
         $localizationFactory = $this->getAccessibleMock(LocalizationFactory::class, array('localizationOverride'));
-        $languageStore = $this->getMock(\TYPO3\CMS\Core\Localization\LanguageStore::class, array('hasData', 'setConfiguration', 'getData', 'setData'));
-        $cacheInstance = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('get', 'set'), array(), '', false);
+        $languageStore = $this->getMockBuilder(\TYPO3\CMS\Core\Localization\LanguageStore::class)
+            ->setMethods(array('hasData', 'setConfiguration', 'getData', 'setData'))
+            ->getMock();
+        $cacheInstance = $this->getMockBuilder(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class)
+            ->setMethods(array('get', 'set'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $localizationFactory->_set('store', $languageStore);
         $localizationFactory->_set('cacheInstance', $cacheInstance);
         $languageStore->method('hasData')->willReturn(false);
index d60e8b7..a498c2d 100644 (file)
@@ -91,7 +91,9 @@ class LoggerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $message = 'test';
         $logger = new Logger($component);
         /** @var $processor \TYPO3\CMS\Core\Log\Processor\ProcessorInterface|\PHPUnit_Framework_MockObject_MockObject */
-        $processor = $this->getMock(NullProcessor::class, array('processLogRecord'));
+        $processor = $this->getMockBuilder(NullProcessor::class)
+            ->setMethods(array('processLogRecord'))
+            ->getMock();
         $processor->expects($this->once())->method('processLogRecord')->will($this->returnValue(new LogRecord($component, $level, $message)));
         $logger->addProcessor($level, $processor);
             // we need a writer, otherwise we will not process log records
@@ -106,7 +108,9 @@ class LoggerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $logger = new Logger('test.core.log');
         /** @var NullWriter|\PHPUnit_Framework_MockObject_MockObject $writer */
-        $writer = $this->getMock(NullWriter::class, array('writeLog'));
+        $writer = $this->getMockBuilder(NullWriter::class)
+            ->setMethods(array('writeLog'))
+            ->getMock();
         $writer->expects($this->once())->method('writeLog');
         $logger->addWriter(LogLevel::DEBUG, $writer);
         $logger->warning('test');
index b8473d8..824578c 100644 (file)
@@ -45,7 +45,9 @@ class AbstractProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $writer = new \TYPO3\CMS\Core\Log\Writer\NullWriter();
         $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
         $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('dummy', $level, 'message');
-        $processor = $this->getMock(\TYPO3\CMS\Core\Log\Processor\ProcessorInterface::class, array('processLogRecord'));
+        $processor = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Processor\ProcessorInterface::class)
+            ->setMethods(array('processLogRecord'))
+            ->getMock();
         $processor->expects($this->once())->method('processLogRecord')->willReturn($logRecord);
 
         $logger->addWriter($level, $writer);
index 47031e2..653b4c0 100644 (file)
@@ -26,7 +26,10 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $logTable = $this->getUniqueId('logtable_');
         /** @var \TYPO3\CMS\Core\Log\Writer\DatabaseWriter|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class, array('dummy'), array(), '', false);
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject->setLogTable($logTable);
         $this->assertSame($logTable, $subject->getLogTable());
     }
@@ -39,12 +42,15 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1345036334);
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->will($this->returnValue(false));
         /** @var \TYPO3\CMS\Core\Log\LogRecord|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $logRecordMock = $this->getMock(\TYPO3\CMS\Core\Log\LogRecord::class, array(), array(), '', false);
+        $logRecordMock = $this->createMock(\TYPO3\CMS\Core\Log\LogRecord::class);
         /** @var \TYPO3\CMS\Core\Log\Writer\DatabaseWriter|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class, array('dummy'), array(), '', false);
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject->writeLog($logRecordMock);
     }
 
@@ -54,12 +60,15 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function writeLogInsertsToSpecifiedTable()
     {
         $logTable = $this->getUniqueId('logtable_');
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->with($logTable, $this->anything());
         /** @var \TYPO3\CMS\Core\Log\LogRecord|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $logRecordMock = $this->getMock(\TYPO3\CMS\Core\Log\LogRecord::class, array(), array(), '', false);
+        $logRecordMock = $this->createMock(\TYPO3\CMS\Core\Log\LogRecord::class);
         /** @var \TYPO3\CMS\Core\Log\Writer\DatabaseWriter|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $subject = $this->getMock(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class, array('dummy'), array(), '', false);
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class)
+            ->setMethods(array('dummy'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $subject->setLogTable($logTable);
         $subject->writeLog($logRecordMock);
     }
@@ -78,7 +87,7 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'data' => '',
         );
         /** @var \TYPO3\CMS\Core\Log\LogRecord|\PHPUnit_Framework_MockObject_MockObject $subject */
-        $logRecordFixture = $this->getMock(\TYPO3\CMS\Core\Log\LogRecord::class, array(), array(), '', false);
+        $logRecordFixture = $this->createMock(\TYPO3\CMS\Core\Log\LogRecord::class);
         $logRecordFixture->expects($this->any())->method('getRequestId')->will($this->returnValue($logRecordData['request_id']));
         $logRecordFixture->expects($this->any())->method('getCreated')->will($this->returnValue($logRecordData['time_micro']));
         $logRecordFixture->expects($this->any())->method('getComponent')->will($this->returnValue($logRecordData['component']));
@@ -90,7 +99,7 @@ class DatabaseWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         #$subject = $this->getMock(\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class, array('dummy'), array(), '', FALSE);
         $subject = new \TYPO3\CMS\Core\Log\Writer\DatabaseWriter();
 
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_INSERTquery')->with($this->anything(), $logRecordData);
 
         $subject->writeLog($logRecordFixture);
index 456d553..ef05555 100644 (file)
@@ -177,8 +177,12 @@ class FileWriterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $this->setUpVfsStream();
 
-        $firstWriter = $this->getMock(\TYPO3\CMS\Core\Log\Writer\FileWriter::class, array('dummy'));
-        $secondWriter = $this->getMock(\TYPO3\CMS\Core\Log\Writer\FileWriter::class, array('createLogFile'));
+        $firstWriter = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Writer\FileWriter::class)
+            ->setMethods(array('dummy'))
+            ->getMock();
+        $secondWriter = $this->getMockBuilder(\TYPO3\CMS\Core\Log\Writer\FileWriter::class)
+            ->setMethods(array('createLogFile'))
+            ->getMock();
 
         $secondWriter->expects($this->never())->method('createLogFile');
 
index 8cf4ae6..62ef98c 100644 (file)
@@ -27,7 +27,10 @@ class MailerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     protected function setUp()
     {
-        $this->subject = $this->getMock(\TYPO3\CMS\Core\Mail\Mailer::class, array('emitPostInitializeMailerSignal'), array(), '', false);
+        $this->subject = $this->getMockBuilder(\TYPO3\CMS\Core\Mail\Mailer::class)
+            ->setMethods(array('emitPostInitializeMailerSignal'))
+            ->disableOriginalConstructor()
+            ->getMock();
     }
 
     //////////////////////////
index 2732a50..e4c0aed 100644 (file)
@@ -31,7 +31,9 @@ class FlashMessageQueueTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     protected function setUp()
     {
-        $this->frontendUser = $this->getMock(\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication::class, array('dummy'));
+        $this->frontendUser = $this->getMockBuilder(\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication::class)
+            ->setMethods(array('dummy'))
+            ->getMock();
         $this->flashMessageQueue = $this->getAccessibleMock(
             \TYPO3\CMS\Core\Messaging\FlashMessageQueue::class,
             array('getUserByContext'),
index 29a48d7..888a843 100644 (file)
@@ -40,8 +40,14 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         vfsStream::setup('Test');
 
         /** @var PhpFrontend|\PHPUnit_Framework_MockObject_MockObject $mockCache */
-        $mockCache = $this->getMock(PhpFrontend::class, array('has', 'set', 'getBackend'), array(), '', false);
-        $mockCacheBackend = $this->getMock(SimpleFileBackend::class, array('has', 'set', 'getBackend', 'getCacheDirectory'), array(), '', false);
+        $mockCache = $this->getMockBuilder(PhpFrontend::class)
+            ->setMethods(array('has', 'set', 'getBackend'))
+            ->disableOriginalConstructor()
+            ->getMock();
+        $mockCacheBackend = $this->getMockBuilder(SimpleFileBackend::class)
+            ->setMethods(array('has', 'set', 'getBackend', 'getCacheDirectory'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $mockCache->expects($this->any())->method('has')->will($this->returnValue(false));
         $mockCache->expects($this->any())->method('set')->will($this->returnValue(true));
         $mockCache->expects($this->any())->method('getBackend')->will($this->returnValue($mockCacheBackend));
@@ -161,7 +167,7 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $packageManager->_set('packageStatesPathAndFilename', 'vfs://Test/Configuration/PackageStates.php');
 
         /** @var DependencyResolver|\PHPUnit_Framework_MockObject_MockObject $dependencyResolver */
-        $dependencyResolver = $this->getMock(DependencyResolver::class);
+        $dependencyResolver = $this->createMock(DependencyResolver::class);
         $dependencyResolver
             ->expects($this->any())
             ->method('sortPackageStatesConfigurationByDependency')
@@ -213,7 +219,7 @@ class PackageManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $packageManager->_set('packageStatesPathAndFilename', 'vfs://Test/Configuration/PackageStates.php');
 
         /** @var DependencyResolver|\PHPUnit_Framework_MockObject_MockObject $dependencyResolver */
-        $dependencyResolver = $this->getMock(DependencyResolver::class);
+        $dependencyResolver = $this->createMock(DependencyResolver::class);
         $dependencyResolver
             ->expects($this->any())
             ->method('sortPackageStatesConfigurationByDependency')
index 1018b7f..117dc2e 100644 (file)
@@ -38,7 +38,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->expectException(InvalidPackagePathException::class);
         $this->expectExceptionCode(1166631890);
 
-        $packageManagerMock = $this->getMock(PackageManager::class);
+        $packageManagerMock = $this->createMock(PackageManager::class);
         $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(true);
         new Package($packageManagerMock, 'Vendor.TestPackage', './ThisPackageSurelyDoesNotExist');
     }
@@ -67,7 +67,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         file_put_contents($packagePath . 'composer.json', '{"name": "' . $packageKey . '", "type": "flow-test"}');
         file_put_contents($packagePath . 'ext_emconf.php', '');
 
-        $packageManagerMock = $this->getMock(PackageManager::class);
+        $packageManagerMock = $this->createMock(PackageManager::class);
         $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(true);
         $package = new Package($packageManagerMock, $packageKey, $packagePath);
         $this->assertEquals($packageKey, $package->getPackageKey());
@@ -96,7 +96,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $packagePath = 'vfs://Packages/' . str_replace('\\', '/', $packageKey) . '/';
         mkdir($packagePath, 0777, true);
 
-        $packageManagerMock = $this->getMock(PackageManager::class);
+        $packageManagerMock = $this->createMock(PackageManager::class);
         new Package($packageManagerMock, $packageKey, $packagePath);
     }
 
@@ -110,7 +110,7 @@ class PackageTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         file_put_contents($packagePath . 'composer.json', '{"name": "vendor/dummy", "type": "flow-test"}');
         file_put_contents($packagePath . 'ext_emconf.php', '');
 
-        $packageManagerMock = $this->getMock(PackageManager::class);
+        $packageManagerMock = $this->createMock(PackageManager::class);
         $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(true);
         $package = new Package($packageManagerMock, 'Vendor.Dummy', $packagePath);
 
index 1c3283f..13c4d5b 100644 (file)
@@ -28,7 +28,9 @@ class PageRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function renderMethodCallsResetInAnyCase()
     {
-        $pageRenderer = $this->getMock(\TYPO3\CMS\Core\Page\PageRenderer::class, array('reset', 'prepareRendering', 'renderJavaScriptAndCss', 'getPreparedMarkerArray', 'getTemplateForPart'));
+        $pageRenderer = $this->getMockBuilder(\TYPO3\CMS\Core\Page\PageRenderer::class)
+            ->setMethods(array('reset', 'prepareRendering', 'renderJavaScriptAndCss', 'getPreparedMarkerArray', 'getTemplateForPart'))
+            ->getMock();
         $pageRenderer->expects($this->exactly(3))->method('reset');
 
         $pageRenderer->render(PageRenderer::PART_COMPLETE);
index b77aca2..b5cc998 100644 (file)
@@ -29,7 +29,7 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array());
+        $GLOBALS['TYPO3_DB'] = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB']->expects($this->any())->method('fullQuoteStr')->will($this->onConsecutiveCalls('\'tx_phpunit\'', '\'someKey\'', '\'tx_phpunit\'', '\'someKey\''));
         $this->registry = new \TYPO3\CMS\Core\Registry();
     }
@@ -125,7 +125,9 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function setAllowsValidNamespaces()
     {
-        $registry = $this->getMock(\TYPO3\CMS\Core\Registry::class, array('loadEntriesByNamespace'));
+        $registry = $this->getMockBuilder(\TYPO3\CMS\Core\Registry::class)
+            ->setMethods(array('loadEntriesByNamespace'))
+            ->getMock();
         $registry->set('tx_thisIsValid', 'someKey', 'someValue');
         $registry->set('thisIsValid', 'someKey', 'someValue');
         $registry->set('user_soIsThis', 'someKey', 'someValue');
@@ -142,7 +144,9 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'entry_key' => 'someKey',
             'entry_value' => serialize('someValue')
         ));
-        $registry = $this->getMock(\TYPO3\CMS\Core\Registry::class, array('loadEntriesByNamespace'));
+        $registry = $this->getMockBuilder(\TYPO3\CMS\Core\Registry::class)
+            ->setMethods(array('loadEntriesByNamespace'))
+            ->getMock();
         $registry->set('tx_phpunit', 'someKey', 'someValue');
     }
 
@@ -157,7 +161,9 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'entry_value' => serialize('someValue')
         ));
         $GLOBALS['TYPO3_DB']->expects($this->never())->method('exec_INSERTquery');
-        $registry = $this->getMock(\TYPO3\CMS\Core\Registry::class, array('loadEntriesByNamespace'));
+        $registry = $this->getMockBuilder(\TYPO3\CMS\Core\Registry::class)
+            ->setMethods(array('loadEntriesByNamespace'))
+            ->getMock();
         $registry->set('tx_phpunit', 'someKey', 'someValue');
     }
 
@@ -186,7 +192,9 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function removeUnsetsValueFromTheInternalEntriesCache()
     {
-        $registry = $this->getMock(\TYPO3\CMS\Core\Registry::class, array('loadEntriesByNamespace'));
+        $registry = $this->getMockBuilder(\TYPO3\CMS\Core\Registry::class)
+            ->setMethods(array('loadEntriesByNamespace'))
+            ->getMock();
         $registry->set('tx_phpunit', 'someKey', 'someValue');
         $registry->set('tx_phpunit', 'someOtherKey', 'someOtherValue');
         $registry->set('tx_otherNamespace', 'someKey', 'someValueInOtherNamespace');
@@ -221,7 +229,9 @@ class RegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function removeAllByNamespaceUnsetsValuesOfTheSpecifiedNamespaceFromTheInternalEntriesCache()
     {
-        $registry = $this->getMock(\TYPO3\CMS\Core\Registry::class, array('loadEntriesByNamespace'));
+        $registry = $this->getMockBuilder(\TYPO3\CMS\Core\Registry::class)
+            ->setMethods(array('loadEntriesByNamespace'))
+            ->getMock();
         $registry->set('tx_phpunit', 'someKey', 'someValue');
         $registry->set('tx_phpunit', 'someOtherKey', 'someOtherValue');
         $registry->set('tx_otherNamespace', 'someKey', 'someValueInOtherNamespace');
index 2688a1d..540c312 100644 (file)
@@ -32,14 +32,17 @@ class AbstractFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $currentIdentifier = '/parent/current/';
 
         /** @var ResourceStorage|\PHPUnit_Framework_MockObject_MockObject $mockedStorageForParent */
-        $mockedStorageForParent = $this->getMock(ResourceStorage::class, array(), array(), '', false);
+        $mockedStorageForParent = $this->createMock(ResourceStorage::class);
 
         /** @var AbstractFile $parentFolderFixture */
         $parentFolderFixture = $this->getMockForAbstractClass(AbstractFile::class);
         $parentFolderFixture->setIdentifier($parentIdentifier)->setStorage($mockedStorageForParent);
 
         /** @var ResourceStorage|\PHPUnit_Framework_MockObject_MockObject $mockedStorage */
-        $mockedStorage = $this->getMock(ResourceStorage::class, array('getFolderIdentifierFromFileIdentifier', 'getFolder'), array(), '', false);
+        $mockedStorage = $this->getMockBuilder(ResourceStorage::class)
+            ->setMethods(array('getFolderIdentifierFromFileIdentifier', 'getFolder'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $mockedStorage->expects($this->once())->method('getFolderIdentifierFromFileIdentifier')->with($currentIdentifier)->will($this->returnValue($parentIdentifier));
         $mockedStorage->expects($this->once())->method('getFolder')->with($parentIdentifier)->will($this->returnValue($parentFolderFixture));
 
index 6e96fae..33ea643 100644 (file)
@@ -119,7 +119,10 @@ abstract class BaseTestCase extends \TYPO3\CMS\Core\Tests\UnitTestCase
                 $mockedMethods[] = 'getName';
             }
         }
-        $mock = $this->getMock($type, $mockedMethods, array(), '', false);
+        $mock = $this->getMockBuilder($type)
+            ->setMethods($mockedMethods)
+            ->disableOriginalConstructor()
+            ->getMock();
         $mock->expects($this->any())->method('getIdentifier')->will($this->returnValue($identifier));
         $mock->expects($this->any())->method('getName')->will($this->returnValue(basename($identifier)));
         return $mock;
index 8dd25b4..0c1e997 100644 (file)
@@ -34,10 +34,10 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function setUp()
     {
         $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
-        $this->storageMock = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $this->storageMock = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
 
-        $mockedMetaDataRepository = $this->getMock(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
+        $mockedMetaDataRepository = $this->createMock(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
         $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
         \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, $mockedMetaDataRepository);
     }
@@ -156,13 +156,12 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
             'uid' => 1,
             'storage' => 'first',
         );
-        $subject = $this->getMock(
-            \TYPO3\CMS\Core\Resource\File::class,
-            array('loadStorage'),
-            array($fileProperties, $this->storageMock)
-        );
-        $mockedNewStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $mockedResourceFactory = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        $subject = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\File::class)
+            ->setMethods(array('loadStorage'))
+            ->setConstructorArgs(array($fileProperties, $this->storageMock))
+            ->getMock();
+        $mockedNewStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockedResourceFactory = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
         $mockedResourceFactory
             ->expects($this->once())
             ->method('getStorageObject')
@@ -178,8 +177,8 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function copyToCallsCopyOperationOnTargetFolderStorage()
     {
-        $targetStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $targetFolder = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array(), array(), '', false);
+        $targetStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $targetFolder = $this->createMock(\TYPO3\CMS\Core\Resource\Folder::class);
         $targetFolder->expects($this->any())->method('getStorage')->will($this->returnValue($targetStorage));
         $fixture = new \TYPO3\CMS\Core\Resource\File(array(), $this->storageMock);
         $targetStorage->expects($this->once())->method('copyFile')->with($this->equalTo($fixture), $this->equalTo($targetFolder));
@@ -191,8 +190,8 @@ class FileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function moveToCallsMoveOperationOnTargetFolderStorage()
     {
-        $targetStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $targetFolder = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array(), array(), '', false);
+        $targetStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $targetFolder = $this->createMock(\TYPO3\CMS\Core\Resource\Folder::class);
         $targetFolder->expects($this->any())->method('getStorage')->will($this->returnValue($targetStorage));
         $fixture = new \TYPO3\CMS\Core\Resource\File(array(), $this->storageMock);
         $targetStorage->expects($this->once())->method('moveFile')->with($this->equalTo($fixture), $this->equalTo($targetFolder));
index 0e91419..42a4474 100644 (file)
@@ -61,7 +61,7 @@ class FileNameFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function filterHiddenFilesAndFoldersFiltersHiddenFilesAndFolders($itemName, $itemIdentifier, $expected)
     {
         /** @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject $driverMock */
-        $driverMock = $this->getMock(DriverInterface::class);
+        $driverMock = $this->createMock(DriverInterface::class);
         $this->assertSame(
             $expected,
             FileNameFilter::filterHiddenFilesAndFolders(
@@ -80,7 +80,7 @@ class FileNameFilterTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function filterHiddenFilesAndFoldersAllowsHiddenFilesAndFolders($itemName, $itemIdentifier, $expected)
     {
         /** @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject $driverMock */
-        $driverMock = $this->getMock(DriverInterface::class);
+        $driverMock = $this->createMock(DriverInterface::class);
         FileNameFilter::setShowHiddenFilesAndFolders(true);
         $this->assertSame(
             FileNameFilter::filterHiddenFilesAndFolders(
index 321d7e6..08a3f88 100644 (file)
@@ -43,7 +43,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     protected function createFolderFixture($path, $name, $mockedStorage = null)
     {
         if ($mockedStorage === null) {
-            $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+            $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         }
         return new \TYPO3\CMS\Core\Resource\Folder($mockedStorage, $path, $name, 0);
     }
@@ -55,7 +55,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $path = $this->getUniqueId();
         $name = $this->getUniqueId();
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $fixture = $this->createFolderFixture($path, $name, $mockedStorage);
         $this->assertSame($mockedStorage, $fixture->getStorage());
         $this->assertStringStartsWith($path, $fixture->getIdentifier());
@@ -88,7 +88,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilesReturnsArrayWithFilenamesAsKeys()
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $mockedStorage->expects($this->once())->method('getFilesInFolder')->will($this->returnValue(array(
                 'somefile.png' => array(
                     'name' => 'somefile.png'
@@ -110,7 +110,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilesHandsOverRecursiveFALSEifNotExplicitlySet()
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $mockedStorage
             ->expects($this->once())
             ->method('getFilesInFolder')
@@ -126,7 +126,7 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getFilesHandsOverRecursiveTRUEifSet()
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $mockedStorage
             ->expects($this->once())
             ->method('getFilesInFolder')
@@ -142,10 +142,10 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function getSubfolderCallsFactoryWithCorrectArguments()
     {
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $mockedStorage->expects($this->once())->method('hasFolderInFolder')->with($this->equalTo('someSubfolder'))->will($this->returnValue(true));
         /** @var \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Resource\ResourceFactory $mockedFactory */
-        $mockedFactory = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        $mockedFactory = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
         $folderFixture = $this->createFolderFixture(
             '/somePath/someFolder/',
             'someFolder',
@@ -173,7 +173,10 @@ class FolderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $currentIdentifier = '/parent/current/';
 
         $parentFolderFixture = $this->createFolderFixture($parentIdentifier, 'parent');
-        $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array('getFolderIdentifierFromFileIdentifier', 'getFolder'), array(), '', false);
+        $mockedStorage = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\ResourceStorage::class)
+            ->setMethods(array('getFolderIdentifierFromFileIdentifier', 'getFolder'))
+            ->disableOriginalConstructor()
+            ->getMock();
         $mockedStorage->expects($this->once())->method('getFolderIdentifierFromFileIdentifier')->with($currentIdentifier)->will($this->returnValue($parentIdentifier));
         $mockedStorage->expects($this->once())->method('getFolder')->with($parentIdentifier)->will($this->returnValue($parentFolderFixture));
 
index 0cdfdb7..52500c4 100644 (file)
@@ -27,7 +27,9 @@ class ExtractorRegistryTest extends UnitTestCase
     public function registeredExtractorClassCanBeRetrieved()
     {
         $extractorClass = 'a9f4d5e4ebb4b03547a2a6094e1170ac';
-        $extractorObject = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass);
+        $extractorObject = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass)
+            ->getMock();
 
         $extractorRegistry = $this->getMockExtractorRegistry(array(array($extractorClass, $extractorObject)));
 
@@ -67,15 +69,21 @@ class ExtractorRegistryTest extends UnitTestCase
     public function registerExtractorClassWithHighestPriorityIsFirstInResult()
     {
         $extractorClass1 = 'db76010e5c24658c35ea1605cce2391d';
-        $extractorObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass1);
+        $extractorObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass1)
+            ->getMock();
         $extractorObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $extractorClass2 = 'ad9195e2487eea33c8a2abd5cf33cba4';
-        $extractorObject2 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass2);
+        $extractorObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass2)
+            ->getMock();
         $extractorObject2->expects($this->any())->method('getPriority')->will($this->returnValue(10));
 
         $extractorClass3 = 'cef9aa4e1cd3aa7ff05dcdccb117156a';
-        $extractorObject3 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass3);
+        $extractorObject3 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass3)
+            ->getMock();
         $extractorObject3->expects($this->any())->method('getPriority')->will($this->returnValue(2));
 
         $createdExtractorInstances = array(
@@ -102,11 +110,15 @@ class ExtractorRegistryTest extends UnitTestCase
     public function registeredExtractorClassWithSamePriorityAreAllReturned()
     {
         $extractorClass1 = 'b70551b2b2db62b6b15a9bbfcbd50614';
-        $extractorObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass1);
+        $extractorObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass1)
+            ->getMock();
         $extractorObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $extractorClass2 = 'ac318f1659d278b79b38262f23a78d5d';
-        $extractorObject2 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass2);
+        $extractorObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class)
+            ->setMockClassName($extractorClass2)
+            ->getMock();
         $extractorObject2->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $createdExtractorInstances = array(
index 7e8233d..84d3895 100644 (file)
@@ -29,13 +29,13 @@ class IndexerTest extends UnitTestCase
      */
     public function isFileTypeSupportedByExtractorReturnsFalesForFileTypeTextAndExtractorLimitedToFileTypeImage()
     {
-        $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
-        $mockFile = $this->getMock(File::class, [], [], '', false);
+        $mockStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockFile = $this->createMock(File::class);
         $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
             File::FILETYPE_TEXT
         ));
 
-        $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
+        $mockExtractor = $this->createMock(ExtractorInterface::class);
         $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
             [File::FILETYPE_IMAGE]
         ));
@@ -56,13 +56,13 @@ class IndexerTest extends UnitTestCase
      */
     public function isFileTypeSupportedByExtractorReturnsTrueForFileTypeImageAndExtractorLimitedToFileTypeImage()
     {
-        $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
-        $mockFile = $this->getMock(File::class, [], [], '', false);
+        $mockStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockFile = $this->createMock(File::class);
         $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
             File::FILETYPE_IMAGE
         ));
 
-        $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
+        $mockExtractor = $this->createMock(ExtractorInterface::class);
         $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
             [File::FILETYPE_IMAGE]
         ));
@@ -83,13 +83,13 @@ class IndexerTest extends UnitTestCase
      */
     public function isFileTypeSupportedByExtractorReturnsTrueForFileTypeTextAndExtractorHasNoFileTypeLimitation()
     {
-        $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
-        $mockFile = $this->getMock(File::class, [], [], '', false);
+        $mockStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockFile = $this->createMock(File::class);
         $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
             File::FILETYPE_TEXT
         ));
 
-        $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
+        $mockExtractor = $this->createMock(ExtractorInterface::class);
         $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
             []
         ));
index c654fb2..47cebd0 100644 (file)
@@ -44,10 +44,10 @@ class ProcessedFileTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected function setUp()
     {
-        $this->storageMock = $this->getMock(ResourceStorage::class, array(), array(), '', false);
+        $this->storageMock = $this->createMock(ResourceStorage::class);
         $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
 
-        $this->folderMock = $this->getMock(Folder::class, array(), array(), '', false);
+        $this->folderMock = $this->createMock(Folder::class);
         $this->folderMock->expects($this->any())->method('getStorage')->willReturn($this->storageMock);
 
         $this->storageMock->expects($this->any())->method('getProcessingFolder')->willReturn($this->folderMock);
index f1b42e5..e3acc77 100644 (file)
@@ -29,16 +29,14 @@ class LocalPreviewHelperTest extends UnitTestCase
      */
     public function processProvidesDefaultSizeIfNotConfigured()
     {
-        $file = $this->getMockBuilder(File::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $file = $this->createMock(File::class);
         // Use size slightly larger than default size to ensure processing
         $file->expects($this->any())->method('getProperty')->will($this->returnValueMap(array(
             array('width', 65),
             array('height', 65),
         )));
 
-        $task = $this->getMock(TaskInterface::class);
+        $task = $this->createMock(TaskInterface::class);
         $task->expects($this->once())->method('getSourceFile')->willReturn($file);
         $task->expects($this->once())->method('getConfiguration')->willReturn(array());
 
@@ -59,9 +57,7 @@ class LocalPreviewHelperTest extends UnitTestCase
      */
     public function processDoesNotScaleUpImages()
     {
-        $file = $this->getMockBuilder(File::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $file = $this->createMock(File::class);
         $file->expects($this->any())->method('getProperty')->will($this->returnValueMap(array(
             array('width', 20),
             array('height', 20),
@@ -72,7 +68,7 @@ class LocalPreviewHelperTest extends UnitTestCase
             ->setMethods(array('dummy'))
             ->getMock();
 
-        $task = $this->getMock(TaskInterface::class);
+        $task = $this->createMock(TaskInterface::class);
         $task->expects($this->once())->method('getSourceFile')->willReturn($file);
         $task->expects($this->once())->method('getConfiguration')->willReturn(array('width' => 30, 'height' => 30));
 
@@ -84,15 +80,13 @@ class LocalPreviewHelperTest extends UnitTestCase
      */
     public function processGeneratesPreviewEvenIfSourceFileHasNoSize()
     {
-        $file = $this->getMockBuilder(File::class)
-            ->disableOriginalConstructor()
-            ->getMock();
+        $file = $this->createMock(File::class);
         $file->expects($this->any())->method('getProperty')->will($this->returnValueMap(array(
             array('width', 0),
             array('height', 0),
         )));
 
-        $task = $this->getMock(TaskInterface::class);
+        $task = $this->createMock(TaskInterface::class);
         $task->expects($this->once())->method('getSourceFile')->willReturn($file);
         $task->expects($this->once())->method('getConfiguration')->willReturn(array());
 
index c34f4a1..8e57ed2 100644 (file)
@@ -36,11 +36,11 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock1 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock1 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock1->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
-        $fileResourceMock2 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock2 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock2->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/wav'));
-        $fileResourceMock3 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock3 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock3->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/ogg'));
 
         $this->assertTrue($audioTagRenderer->canRender($fileResourceMock1));
@@ -55,7 +55,7 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
 
         $this->assertFalse($audioTagRenderer->canRender($fileResourceMock));
@@ -68,7 +68,7 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myAudioFile?foo=bar&baz=true'));
 
@@ -85,7 +85,7 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myAudioFile'));
 
@@ -102,7 +102,7 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myAudioFile'));
 
@@ -119,7 +119,7 @@ class AudioTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $audioTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myAudioFile'));
 
index 342a714..393274b 100644 (file)
@@ -46,7 +46,9 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function registeredFileRenderClassCanBeRetrieved()
     {
         $rendererClass = $this->getUniqueId('myRenderer');
-        $rendererObject = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass);
+        $rendererObject = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass)
+            ->getMock();
 
         $rendererRegistry = $this->getTestRendererRegistry(array(array($rendererClass, $rendererObject)));
 
@@ -85,15 +87,21 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function registerRendererClassWithHighestPriorityIsFirstInResult()
     {
         $rendererClass1 = $this->getUniqueId('myRenderer1');
-        $rendererObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass1);
+        $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass1)
+            ->getMock();
         $rendererObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $rendererClass2 = $this->getUniqueId('myRenderer2');
-        $rendererObject2 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass2);
+        $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass2)
+            ->getMock();
         $rendererObject2->expects($this->any())->method('getPriority')->will($this->returnValue(10));
 
         $rendererClass3 = $this->getUniqueId('myRenderer3');
-        $rendererObject3 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass3);
+        $rendererObject3 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass3)
+            ->getMock();
         $rendererObject3->expects($this->any())->method('getPriority')->will($this->returnValue(2));
 
         $createdRendererInstances = array(
@@ -119,11 +127,15 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function registeredFileRendererClassWithSamePriorityAreAllReturned()
     {
         $rendererClass1 = $this->getUniqueId('myRenderer1');
-        $rendererObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass1);
+        $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass1)
+            ->getMock();
         $rendererObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $rendererClass2 = $this->getUniqueId('myRenderer2');
-        $rendererObject2 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass2);
+        $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMockClassName($rendererClass2)
+            ->getMock();
         $rendererObject2->expects($this->any())->method('getPriority')->will($this->returnValue(1));
 
         $createdRendererInstances = array(
@@ -148,16 +160,22 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->markTestSkipped('Test triggers an error. This is a known PHP bug (http://stackoverflow.com/questions/3235387/usort-array-was-modified-by-the-user-comparison-function)');
 
         $rendererClass1 = $this->getUniqueId('myVideoRenderer');
-        $rendererObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array('getPriority', 'canRender', 'render'), array(), $rendererClass1);
+        $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMethods(array('getPriority', 'canRender', 'render'))
+            ->setMockClassName($rendererClass1)
+            ->getMock();
         $rendererObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
         $rendererObject1->expects($this->once())->method('canRender')->will($this->returnValue(true));
 
         $rendererClass2 = $this->getUniqueId('myAudioRenderer');
-        $rendererObject2 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array('getPriority', 'canRender', 'render'), array(), $rendererClass2);
+        $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
+            ->setMethods(array('getPriority', 'canRender', 'render'))
+            ->setMockClassName($rendererClass2)
+            ->getMock();
         $rendererObject2->expects($this->any())->method('getPriority')->will($this->returnValue(10));
         $rendererObject2->expects($this->once())->method('canRender')->will($this->returnValue(false));
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
 
         $createdRendererInstances = array(
             array($rendererClass1, $rendererObject1),
@@ -184,7 +202,7 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $rendererRegistry->registerRendererClass(\TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer::class);
         $rendererRegistry->registerRendererClass(\TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer::class);
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
 
         $rendererRegistry->getRendererInstances();
index 906933b..e8dabe4 100644 (file)
@@ -36,13 +36,13 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock1 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock1 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock1->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
-        $fileResourceMock2 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock2 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock2->expects($this->any())->method('getMimeType')->will($this->returnValue('video/webm'));
-        $fileResourceMock3 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock3 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock3->expects($this->any())->method('getMimeType')->will($this->returnValue('video/ogg'));
-        $fileResourceMock4 = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock4 = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock4->expects($this->any())->method('getMimeType')->will($this->returnValue('application/ogg'));
 
         $this->assertTrue($VideoTagRenderer->canRender($fileResourceMock1));
@@ -58,7 +58,7 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('audio/mpeg'));
 
         $this->assertFalse($VideoTagRenderer->canRender($fileResourceMock));
@@ -71,7 +71,7 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myVideoFile?foo=bar&baz=true'));
 
@@ -88,7 +88,7 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myVideoFile'));
 
@@ -105,7 +105,7 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myVideoFile'));
 
@@ -122,7 +122,7 @@ class VideoTagRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     {
         $VideoTagRenderer = new \TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer();
 
-        $fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(\TYPO3\CMS\Core\Resource\File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/mp4'));
         $fileResourceMock->expects($this->any())->method('getPublicUrl')->will($this->returnValue('//:path/myVideoFile'));
 
index 8821024..a200606 100644 (file)
@@ -59,10 +59,10 @@ class VimeoRendererTest extends UnitTestCase
     public function canRenderReturnsTrueOnCorrectFile()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock1 */
-        $fileResourceMock1 = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock1 = $this->createMock(File::class);
         $fileResourceMock1->expects($this->any())->method('getMimeType')->will($this->returnValue('video/vimeo'));
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock2 */
-        $fileResourceMock2 = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock2 = $this->createMock(File::class);
         $fileResourceMock2->expects($this->any())->method('getMimeType')->will($this->returnValue('video/unknown'));
         $fileResourceMock2->expects($this->any())->method('getExtension')->will($this->returnValue('vimeo'));
 
@@ -76,7 +76,7 @@ class VimeoRendererTest extends UnitTestCase
     public function canRenderReturnsFalseOnCorrectFile()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/youtube'));
 
         $this->assertFalse($this->subject->canRender($fileResourceMock));
@@ -88,7 +88,7 @@ class VimeoRendererTest extends UnitTestCase
     public function renderOutputIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//player.vimeo.com/video/7331?title=0&amp;byline=0&amp;portrait=0" allowfullscreen width="300" height="200"></iframe>',
@@ -102,7 +102,7 @@ class VimeoRendererTest extends UnitTestCase
     public function renderOutputWithLoopIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//player.vimeo.com/video/7331?loop=1&amp;title=0&amp;byline=0&amp;portrait=0" allowfullscreen width="300" height="200"></iframe>',
@@ -116,7 +116,7 @@ class VimeoRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//player.vimeo.com/video/7331?autoplay=1&amp;title=0&amp;byline=0&amp;portrait=0" allowfullscreen width="300" height="200"></iframe>',
@@ -130,10 +130,10 @@ class VimeoRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayFromReferenceIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         /** @var FileReference|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileReferenceMock = $this->getMock(FileReference::class, array(), array(), '', false);
+        $fileReferenceMock = $this->createMock(FileReference::class);
         $fileReferenceMock->expects($this->any())->method('getProperty')->will($this->returnValue(1));
         $fileReferenceMock->expects($this->any())->method('getOriginalFile')->willReturn($fileResourceMock);
 
@@ -149,7 +149,7 @@ class VimeoRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayAndWithoutControllsIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//player.vimeo.com/video/7331?autoplay=1&amp;title=0&amp;byline=0&amp;portrait=0" allowfullscreen width="300" height="200"></iframe>',
index a9cd3fa..82060c7 100644 (file)
@@ -62,10 +62,10 @@ class YouTubeRendererTest extends UnitTestCase
     public function canRenderReturnsTrueOnCorrectFile()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock1 */
-        $fileResourceMock1 = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock1 = $this->createMock(File::class);
         $fileResourceMock1->expects($this->any())->method('getMimeType')->will($this->returnValue('video/youtube'));
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock2 */
-        $fileResourceMock2 = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock2 = $this->createMock(File::class);
         $fileResourceMock2->expects($this->any())->method('getMimeType')->will($this->returnValue('video/unknown'));
         $fileResourceMock2->expects($this->any())->method('getExtension')->will($this->returnValue('youtube'));
 
@@ -79,7 +79,7 @@ class YouTubeRendererTest extends UnitTestCase
     public function canRenderReturnsFalseOnCorrectFile()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
         $fileResourceMock->expects($this->any())->method('getMimeType')->will($this->returnValue('video/vimeo'));
 
         $this->assertFalse($this->subject->canRender($fileResourceMock));
@@ -91,7 +91,7 @@ class YouTubeRendererTest extends UnitTestCase
     public function renderOutputIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//www.youtube.com/embed/7331?autohide=1&amp;controls=2&amp;enablejsapi=1&amp;origin=test.server.org&amp;showinfo=0" allowfullscreen width="300" height="200"></iframe>',
@@ -105,7 +105,7 @@ class YouTubeRendererTest extends UnitTestCase
     public function renderOutputWithLoopIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//www.youtube.com/embed/7331?autohide=1&amp;controls=2&amp;loop=1&amp;enablejsapi=1&amp;origin=test.server.org&amp;showinfo=0" allowfullscreen width="300" height="200"></iframe>',
@@ -119,7 +119,7 @@ class YouTubeRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//www.youtube.com/embed/7331?autohide=1&amp;controls=2&amp;autoplay=1&amp;enablejsapi=1&amp;origin=test.server.org&amp;showinfo=0" allowfullscreen width="300" height="200"></iframe>',
@@ -133,10 +133,10 @@ class YouTubeRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayFromFileReferenceIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         /** @var FileReference|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileReferenceMock = $this->getMock(FileReference::class, array(), array(), '', false);
+        $fileReferenceMock = $this->createMock(FileReference::class);
         $fileReferenceMock->expects($this->any())->method('getProperty')->will($this->returnValue(1));
         $fileReferenceMock->expects($this->any())->method('getOriginalFile')->willReturn($fileResourceMock);
 
@@ -152,7 +152,7 @@ class YouTubeRendererTest extends UnitTestCase
     public function renderOutputWithAutoplayAndWithoutControllsIsCorrect()
     {
         /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
-        $fileResourceMock = $this->getMock(File::class, array(), array(), '', false);
+        $fileResourceMock = $this->createMock(File::class);
 
         $this->assertSame(
             '<iframe src="//www.youtube.com/embed/7331?autohide=1&amp;autoplay=1&amp;enablejsapi=1&amp;origin=test.server.org&amp;showinfo=0" allowfullscreen width="300" height="200"></iframe>',
index e39f78a..c2cb1a4 100644 (file)
@@ -28,7 +28,7 @@ class AbstractRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
 
     protected function createDatabaseMock()
     {
-        $this->mockedDb = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+        $this->mockedDb = $this->createMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $GLOBALS['TYPO3_DB'] = $this->mockedDb;
     }
 
@@ -93,7 +93,7 @@ class AbstractRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function getWhereClauseForEnabledFieldsCallsSysPageForDeletedFlagInFrontend()
     {
         $GLOBALS['TSFE'] = new \stdClass();
-        $sysPageMock = $this->getMock(\TYPO3\CMS\Frontend\Page\PageRepository::class);
+        $sysPageMock = $this->createMock(\TYPO3\CMS\Frontend\Page\PageRepository::class);
         $GLOBALS['TSFE']->sys_page = $sysPageMock;
         $sysPageMock
             ->expects($this->once())
index 72280f0..aee41f1 100644 (file)
@@ -57,7 +57,7 @@ class ResourceFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function createStorageCollectionObjectCreatesCollectionWithCorrectArguments()
     {
-        $mockedMount = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
+        $mockedMount = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $path = $this->getUniqueId();
         $name = $this->getUniqueId();
         $storageCollection = $this->subject->createFolderObject($mockedMount, $path, $name, 0);
@@ -77,8 +77,8 @@ class ResourceFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $mockedDriver = $this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Driver\AbstractDriver::class);
         $driverFixtureClass = get_class($mockedDriver);
         \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance($driverFixtureClass, $mockedDriver);
-        $mockedMount = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
-        $mockedRegistry = $this->getMock(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
+        $mockedMount = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
+        $mockedRegistry = $this->createMock(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
         $mockedRegistry->expects($this->once())->method('getDriverClass')->with($this->equalTo($driverFixtureClass))->will($this->returnValue($driverFixtureClass));
         \TYPO3\