[TASK] Migrate Tests from _callRef to _call 93/62493/4
authorBenni Mack <benni@typo3.org>
Fri, 29 Nov 2019 14:46:36 +0000 (15:46 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 2 Dec 2019 07:36:55 +0000 (08:36 +0100)
Tests should be consistent and reflect the
way we do things in Core. However, testing
framework offers too many different ways to do things,
and "_callRef" is one of that.

Resolves: #89817
Releases: master
Change-Id: I44759df255365d0f90e0928f3f5726b66ecf9f3e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62493
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
14 files changed:
typo3/sysext/backend/Tests/Unit/Controller/EditDocumentControllerTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractHierarchicalFilesystemDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceFactoryTest.php
typo3/sysext/core/Tests/Unit/TypoScript/Parser/TypoScriptParserTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.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/Storage/Typo3DbBackendTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbQueryParserTest.php
typo3/sysext/extbase/Tests/Unit/Property/PropertyMapperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/PageViewHelperTest.php
typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/recordlist/Tests/Unit/RecordList/DatabaseRecordListTest.php

index a780610..8630752 100644 (file)
@@ -15,7 +15,11 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Prophecy\Argument;
 use TYPO3\CMS\Backend\Controller\EditDocumentController;
+use TYPO3\CMS\Backend\Template\ModuleTemplate;
+use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -43,8 +47,16 @@ class EditDocumentControllerTest extends UnitTestCase
             'magic' => 'yes'
         ];
         $result = [];
-        $mock = $this->getAccessibleMock(EditDocumentController::class, ['dummy'], [], '', false);
-        $mock->_callRef('parseAdditionalGetParameters', $result, $typoScript);
+        $moduleTemplate = $this->prophesize(ModuleTemplate::class);
+        $moduleTemplate->setUiBlock(Argument::any())->willReturn($moduleTemplate->reveal());
+        $GLOBALS['LANG'] = $this->prophesize(LanguageService::class)->reveal();
+        GeneralUtility::addInstance(ModuleTemplate::class, $moduleTemplate->reveal());
+
+        $mock = \Closure::bind(static function (EditDocumentController $editDocumentController) use (&$result, $typoScript) {
+            return $editDocumentController->parseAdditionalGetParameters($result, $typoScript);
+        }, null, EditDocumentController::class);
+        $mock(new EditDocumentController());
+
         self::assertSame($expectedParameters, $result);
     }
 
index da7c410..2038ef7 100644 (file)
@@ -41,7 +41,7 @@ class AbstractHierarchicalFilesystemDriverTest extends BaseTestCase
      */
     public function canonicalizeAndCheckFileIdentifierCanonicalizesPath($expectedPath, $fileIdentifier)
     {
-        self::assertSame($expectedPath, $this->subject->_callRef('canonicalizeAndCheckFileIdentifier', $fileIdentifier));
+        self::assertSame($expectedPath, $this->subject->_call('canonicalizeAndCheckFileIdentifier', $fileIdentifier));
     }
 
     /**
@@ -93,7 +93,7 @@ class AbstractHierarchicalFilesystemDriverTest extends BaseTestCase
      */
     public function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier($expectedPath, $identifier)
     {
-        self::assertSame($expectedPath, $this->subject->_callRef('canonicalizeAndCheckFolderIdentifier', $identifier));
+        self::assertSame($expectedPath, $this->subject->_call('canonicalizeAndCheckFolderIdentifier', $identifier));
     }
 
     /**
index dbe34ff..a6832d3 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\EventDispatcher\EventDispatcherInterface;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
@@ -166,8 +167,12 @@ class ResourceFactoryTest extends UnitTestCase
      */
     public function findBestMatchingStorageByLocalPathReturnsDefaultStorageIfNoMatchIsFound(array $storageConfiguration, $path, $expectedStorageId)
     {
-        $this->subject->_set('localDriverStorageCache', $storageConfiguration);
-        self::assertSame($expectedStorageId, $this->subject->_callRef('findBestMatchingStorageByLocalPath', $path));
+        $resourceFactory = new ResourceFactory($this->prophesize(EventDispatcherInterface::class)->reveal());
+        $mock = \Closure::bind(static function (ResourceFactory $resourceFactory) use (&$path, $storageConfiguration) {
+            $resourceFactory->localDriverStorageCache = $storageConfiguration;
+            return $resourceFactory->findBestMatchingStorageByLocalPath($path);
+        }, null, ResourceFactory::class);
+        self::assertSame($expectedStorageId, $mock($resourceFactory));
     }
 
     /**
index 8954e69..3b053ec 100644 (file)
@@ -1135,7 +1135,15 @@ test.TYPO3Forever.TypoScript = 1
         $string = '';
         $setup = [];
         $value = [];
-        $this->typoScriptParser->_callRef('setVal', $string, $setup, $value);
+        $typoScriptParser = new TypoScriptParser();
+        $mock = \Closure::bind(
+            static function (TypoScriptParser $typoScriptParser) use ($string, &$setup, $value) {
+                return $typoScriptParser->setVal($string, $setup, $value);
+            },
+            null,
+            TypoScriptParser::class
+        );
+        $mock($typoScriptParser);
     }
 
     /**
@@ -1146,7 +1154,15 @@ test.TYPO3Forever.TypoScript = 1
         $string = '';
         $setup = [];
         $value = '';
-        $this->typoScriptParser->_callRef('setVal', $string, $setup, $value);
+        $typoScriptParser = new TypoScriptParser();
+        $mock = \Closure::bind(
+            static function (TypoScriptParser $typoScriptParser) use ($string, &$setup, $value) {
+                return $typoScriptParser->setVal($string, $setup, $value);
+            },
+            null,
+            TypoScriptParser::class
+        );
+        $mock($typoScriptParser);
     }
 
     /**
index 5900a08..336c7ac 100644 (file)
@@ -875,7 +875,7 @@ class UriBuilderTest extends UnitTestCase
         $extensionName = 'ExtensionName';
         $pluginName = 'PluginName';
         $expectedResult = ['controller' => 'SomeController', 'action' => 'someAction', 'foo' => 'bar'];
-        $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
+        $actualResult = $this->uriBuilder->_call('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
         self::assertEquals($expectedResult, $actualResult);
     }
 
@@ -890,7 +890,7 @@ class UriBuilderTest extends UnitTestCase
         $extensionName = 'ExtensionName';
         $pluginName = 'PluginName';
         $expectedResult = ['action' => 'someAction', 'foo' => 'bar'];
-        $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
+        $actualResult = $this->uriBuilder->_call('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
         self::assertEquals($expectedResult, $actualResult);
     }
 
@@ -905,7 +905,7 @@ class UriBuilderTest extends UnitTestCase
         $extensionName = 'ExtensionName';
         $pluginName = 'PluginName';
         $expectedResult = ['controller' => 'SomeController', 'foo' => 'bar'];
-        $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
+        $actualResult = $this->uriBuilder->_call('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
         self::assertEquals($expectedResult, $actualResult);
     }
 
@@ -920,7 +920,7 @@ class UriBuilderTest extends UnitTestCase
         $extensionName = 'ExtensionName';
         $pluginName = 'PluginName';
         $expectedResult = ['foo' => 'bar'];
-        $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
+        $actualResult = $this->uriBuilder->_call('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName);
         self::assertEquals($expectedResult, $actualResult);
     }
 
index b579df9..eae656e 100644 (file)
@@ -55,7 +55,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::once())->method('setOneToOneRelation')->willReturn($mockColumnMap);
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::never())->method('setManyToManyRelation');
-        $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
+        $mockDataMapFactory->_call('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
     }
 
     /**
@@ -121,7 +121,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::once())->method('setManyToManyRelation')->willReturn($mockColumnMap);
-        $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
+        $mockDataMapFactory->_call('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
     }
 
     /**
@@ -142,7 +142,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::once())->method('setOneToManyRelation')->willReturn($mockColumnMap);
         $mockDataMapFactory->expects(self::never())->method('setManyToManyRelation');
-        $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
+        $mockDataMapFactory->_call('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
     }
 
     /**
@@ -166,7 +166,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::never())->method('setManyToManyRelation');
-        $actualColumnMap = $mockDataMapFactory->_callRef('setRelations', $columnMap, $columnConfiguration, $type, $elementType);
+        $actualColumnMap = $mockDataMapFactory->_call('setRelations', $columnMap, $columnConfiguration, $type, $elementType);
         self::assertSame($columnMap::RELATION_NONE, $actualColumnMap->getTypeOfRelation());
     }
 
@@ -206,7 +206,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::never())->method('setManyToManyRelation');
-        $actualColumnMap = $mockDataMapFactory->_callRef('setRelations', $columnMap, $columnConfiguration, $type, $elementType);
+        $actualColumnMap = $mockDataMapFactory->_call('setRelations', $columnMap, $columnConfiguration, $type, $elementType);
         self::assertSame($relation, $actualColumnMap->getTypeOfRelation());
     }
 
@@ -227,7 +227,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::once())->method('setManyToManyRelation')->willReturn($mockColumnMap);
-        $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
+        $mockDataMapFactory->_call('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
     }
 
     /**
@@ -247,7 +247,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockDataMapFactory->expects(self::never())->method('setOneToOneRelation');
         $mockDataMapFactory->expects(self::never())->method('setOneToManyRelation');
         $mockDataMapFactory->expects(self::once())->method('setManyToManyRelation')->willReturn($mockColumnMap);
-        $mockDataMapFactory->_callRef('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
+        $mockDataMapFactory->_call('setRelations', $mockColumnMap, $columnConfiguration, $type, $elementType);
     }
 
     /**
@@ -274,7 +274,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockColumnMap->expects(self::never())->method('setRelationTableMatchFields');
         $mockColumnMap->expects(self::never())->method('setRelationTableInsertFields');
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
-        $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
+        $mockDataMapFactory->_call('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
     }
 
     /**
@@ -301,7 +301,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockColumnMap->expects(self::never())->method('setRelationTableMatchFields');
         $mockColumnMap->expects(self::never())->method('setRelationTableInsertFields');
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['dummy'], [], '', false);
-        $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $rightColumnsDefinition['lefts']);
+        $mockDataMapFactory->_call('setManyToManyRelation', $mockColumnMap, $rightColumnsDefinition['lefts']);
     }
 
     /**
@@ -328,7 +328,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockColumnMap->expects(self::never())->method('setRelationTableInsertFields');
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getColumnsDefinition'], [], '', false);
         $mockDataMapFactory->expects(self::never())->method('getColumnsDefinition');
-        $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
+        $mockDataMapFactory->_call('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
     }
 
     /**
@@ -350,7 +350,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockColumnMap->expects(self::never())->method('setrelationTablePageIdColumnName');
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getControlSection'], [], '', false);
         $mockDataMapFactory->expects(self::once())->method('getControlSection')->with(self::equalTo('tx_myextension_mm'))->willReturn(null);
-        $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
+        $mockDataMapFactory->_call('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
     }
 
     /**
@@ -372,7 +372,7 @@ class DataMapFactoryTest extends UnitTestCase
         $mockColumnMap->expects(self::once())->method('setrelationTablePageIdColumnName')->with(self::equalTo('pid'));
         $mockDataMapFactory = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::class, ['getControlSection'], [], '', false);
         $mockDataMapFactory->expects(self::once())->method('getControlSection')->with(self::equalTo('tx_myextension_mm'))->willReturn(['ctrl' => ['foo' => 'bar']]);
-        $mockDataMapFactory->_callRef('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
+        $mockDataMapFactory->_call('setManyToManyRelation', $mockColumnMap, $leftColumnsDefinition['rights']);
     }
 
     /**
@@ -420,7 +420,7 @@ class DataMapFactoryTest extends UnitTestCase
             '',
             false
         );
-        $accessibleDataMapFactory->_callRef('setFieldEvaluations', $mockColumnMap, $columnDefinition);
+        $accessibleDataMapFactory->_call('setFieldEvaluations', $mockColumnMap, $columnDefinition);
     }
 
     /**
index 5723a1e..7c0ff55 100644 (file)
@@ -320,7 +320,7 @@ class DataMapperTest extends UnitTestCase
         $accessibleDataMapFactory = $this->getAccessibleMock(DataMapper::class, ['dummy'], [], '', false);
 
         /** @var $dateTime NULL|\DateTime */
-        $dateTime = $accessibleDataMapFactory->_callRef('mapDateTime', $value, $storageFormat);
+        $dateTime = $accessibleDataMapFactory->_call('mapDateTime', $value, $storageFormat);
 
         if ($expectedValue === null) {
             self::assertNull($dateTime);
@@ -341,7 +341,7 @@ class DataMapperTest extends UnitTestCase
         $storageFormat = 'datetime';
 
         /** @var $dateTime NULL|\DateTime */
-        $dateTime = $accessibleDataMapFactory->_callRef('mapDateTime', $date, $storageFormat, $targetType);
+        $dateTime = $accessibleDataMapFactory->_call('mapDateTime', $date, $storageFormat, $targetType);
 
         self::assertInstanceOf($targetType, $dateTime);
     }
index 77b5710..5b16eab 100644 (file)
@@ -128,7 +128,7 @@ class Typo3DbBackendTest extends UnitTestCase
         $mockTypo3DbBackend->_set('dataMapper', $mockDataMapper);
         $mockTypo3DbBackend->_set('connectionPool', $connectionPoolProphet->reveal());
         $mockTypo3DbBackend->_set('environmentService', $environmentServiceProphet->reveal());
-        $result = $mockTypo3DbBackend->_callRef('getUidOfAlreadyPersistedValueObject', $mockValueObject);
+        $result = $mockTypo3DbBackend->getUidOfAlreadyPersistedValueObject($mockValueObject);
         self::assertSame($expectedUid, $result);
     }
 }
index 8fad42a..c5449fe 100644 (file)
@@ -353,7 +353,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $sql = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = $table . '.sys_language_uid IN (0, -1)';
         self::assertSame($expectedSql, $sql);
     }
@@ -375,7 +375,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $sql = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $result = $table . '.sys_language_uid IN (1, -1)';
         self::assertSame($result, $sql);
     }
@@ -393,7 +393,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $sql = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = $table . '.sys_language_uid IN (0, -1)';
         self::assertSame($expectedSql, $sql);
     }
@@ -413,7 +413,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $sql = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = $table . '.sys_language_uid IN (0, -1)';
         self::assertSame($expectedSql, $sql);
     }
@@ -432,7 +432,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $sql = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = $table . '.sys_language_uid IN (2, -1)';
         self::assertSame($expectedSql, $sql);
     }
@@ -455,7 +455,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
 
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
 
-        $compositeExpression = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $compositeExpression = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = '(' . $table . '.sys_language_uid = -1) OR ((' . $table . '.sys_language_uid = 2) AND (' . $table . '.l10n_parent IN (SELECT ' . $table . '_dl.uid FROM ' . $table . ' ' . $table . '_dl WHERE (' . $table . '_dl.l10n_parent = 0) AND (' . $table . '_dl.sys_language_uid = 0)))) OR ((' . $table . '.sys_language_uid = 0) AND (' . $table . '.uid NOT IN (SELECT ' . $table . '_to.l10n_parent FROM ' . $table . ' ' . $table . '_dl, ' . $table . ' ' . $table . '_to WHERE (' . $table . '_to.l10n_parent > 0) AND (' . $table . '_to.sys_language_uid = 2))))';
         self::assertSame($expectedSql, $compositeExpression->__toString());
     }
@@ -476,7 +476,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderProphetWithQueryBuilderForSubselect();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $compositeExpression= $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $compositeExpression= $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = '(' . $table . '.sys_language_uid = -1) OR ((' . $table . '.sys_language_uid = 2) AND (' . $table . '.l10n_parent IN (SELECT ' . $table . '_dl.uid FROM ' . $table . ' ' . $table . '_dl WHERE (' . $table . '_dl.l10n_parent = 0) AND (' . $table . '_dl.sys_language_uid = 0) AND (' . $table . '_dl.deleted = 0)))) OR ((' . $table . '.sys_language_uid = 0) AND (' . $table . '.uid NOT IN (SELECT ' . $table . '_to.l10n_parent FROM ' . $table . ' ' . $table . '_dl, ' . $table . ' ' . $table . '_to WHERE (' . $table . '_to.l10n_parent > 0) AND (' . $table . '_to.sys_language_uid = 2) AND ((' . $table . '_dl.deleted = 0) AND (' . $table . '_to.deleted = 0)))))';
         self::assertSame($expectedSql, $compositeExpression->__toString());
     }
@@ -499,7 +499,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $queryBuilderProphet = $this->getQueryBuilderProphetWithQueryBuilderForSubselect();
 
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $compositeExpression = $mockTypo3DbQueryParser->_callRef('getLanguageStatement', $table, $table, $querySettings);
+        $compositeExpression = $mockTypo3DbQueryParser->_call('getLanguageStatement', $table, $table, $querySettings);
         $expectedSql = '(' . $table . '.sys_language_uid = -1) OR ((' . $table . '.sys_language_uid = 2) AND (' . $table . '.l10n_parent IN (SELECT ' . $table . '_dl.uid FROM ' . $table . ' ' . $table . '_dl WHERE (' . $table . '_dl.l10n_parent = 0) AND (' . $table . '_dl.sys_language_uid = 0) AND (' . $table . '_dl.deleted = 0)))) OR ((' . $table . '.sys_language_uid = 0) AND (' . $table . '.uid NOT IN (SELECT ' . $table . '_to.l10n_parent FROM ' . $table . ' ' . $table . '_dl, ' . $table . ' ' . $table . '_to WHERE (' . $table . '_to.l10n_parent > 0) AND (' . $table . '_to.sys_language_uid = 2) AND ((' . $table . '_dl.deleted = 0) AND (' . $table . '_to.deleted = 0)))))';
         self::assertSame($expectedSql, $compositeExpression->__toString());
     }
@@ -527,7 +527,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $mockTypo3DbQueryParser->_set('dataMapper', $mockDataMapper);
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource);
+        $mockTypo3DbQueryParser->_call('parseOrderings', $orderings, $mockSource);
     }
 
     /**
@@ -552,7 +552,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $mockTypo3DbQueryParser->_set('dataMapper', $mockDataMapper);
 
-        $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource);
+        $mockTypo3DbQueryParser->_call('parseOrderings', $orderings, $mockSource);
     }
 
     /**
@@ -586,7 +586,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $queryBuilder->expects(self::at(1))->method('addOrderBy')->with('tx_myext_tablename.converted_fieldname', 'DESC');
 
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilder);
-        $mockTypo3DbQueryParser->_callRef('parseOrderings', $orderings, $mockSource);
+        $mockTypo3DbQueryParser->_call('parseOrderings', $orderings, $mockSource);
     }
 
     public function providerForVisibilityConstraintStatement()
@@ -653,7 +653,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
 
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
-        $resultSql = $mockTypo3DbQueryParser->_callRef('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
+        $resultSql = $mockTypo3DbQueryParser->_call('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
         self::assertSame($expectedSql, $resultSql);
         unset($GLOBALS['TCA'][$tableName]);
     }
@@ -717,7 +717,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
 
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
-        $actualSql = $mockTypo3DbQueryParser->_callRef('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
+        $actualSql = $mockTypo3DbQueryParser->_call('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
         self::assertSame($expectedSql, $actualSql);
         unset($GLOBALS['TCA'][$tableName]);
     }
@@ -752,7 +752,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
 
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $mockTypo3DbQueryParser->_set('environmentService', $mockEnvironmentService);
-        $mockTypo3DbQueryParser->_callRef('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
+        $mockTypo3DbQueryParser->_call('getVisibilityConstraintStatement', $mockQuerySettings, $tableName, $tableName);
         unset($GLOBALS['TCA'][$tableName]);
     }
 
@@ -804,7 +804,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
         $mockTypo3DbQueryParser = $this->getAccessibleMock(Typo3DbQueryParser::class, ['dummy'], [], '', false);
         $queryBuilderProphet = $this->getQueryBuilderWithExpressionBuilderProphet();
         $mockTypo3DbQueryParser->_set('queryBuilder', $queryBuilderProphet->reveal());
-        $sql = $mockTypo3DbQueryParser->_callRef('getPageIdStatement', $table, $table, $storagePageIds);
+        $sql = $mockTypo3DbQueryParser->_call('getPageIdStatement', $table, $table, $storagePageIds);
 
         self::assertSame($expectedSql, $sql);
     }
index 70e7a7f..bde1d75 100644 (file)
@@ -14,7 +14,9 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Property;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 use TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException;
+use TYPO3\CMS\Extbase\Property\PropertyMapper;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderOneInterface;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderThree;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\Fixtures\DataProviderThreeInterface;
@@ -369,11 +371,16 @@ class PropertyMapperTest extends UnitTestCase
      */
     public function doMappingReturnsSourceUnchangedIfAlreadyConverted()
     {
-        $source = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-        $targetType = \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class;
+        $source = new ObjectStorage();
+        $targetType = ObjectStorage::class;
         $propertyPath = '';
-        $propertyMapper = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Property\PropertyMapper::class, ['dummy']);
-        self::assertSame($source, $propertyMapper->_callRef('doMapping', $source, $targetType, $this->mockConfiguration, $propertyPath));
+        $propertyMapper = new PropertyMapper();
+        $mockConf = $this->mockConfiguration;
+        $mock = \Closure::bind(static function (PropertyMapper $propertyMapper) use ($source, $targetType, $mockConf, &$propertyPath) {
+            return $propertyMapper->doMapping($source, $targetType, $mockConf, $propertyPath);
+        }, null, PropertyMapper::class);
+
+        self::assertSame($source, $mock($propertyMapper));
     }
 
     /**
@@ -381,11 +388,16 @@ class PropertyMapperTest extends UnitTestCase
      */
     public function doMappingReturnsSourceUnchangedIfAlreadyConvertedToCompositeType()
     {
-        $source = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
-        $targetType = \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class . '<SomeEntity>';
+        $source = new ObjectStorage();
+        $targetType = ObjectStorage::class . '<SomeEntity>';
         $propertyPath = '';
-        $propertyMapper = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Property\PropertyMapper::class, ['dummy']);
-        self::assertSame($source, $propertyMapper->_callRef('doMapping', $source, $targetType, $this->mockConfiguration, $propertyPath));
+        $propertyMapper = new PropertyMapper();
+        $mockConf = $this->mockConfiguration;
+        $mock = \Closure::bind(static function (PropertyMapper $propertyMapper) use ($source, $targetType, $mockConf, &$propertyPath) {
+            return $propertyMapper->doMapping($source, $targetType, $mockConf, $propertyPath);
+        }, null, PropertyMapper::class);
+
+        self::assertSame($source, $mock($propertyMapper));
     }
 
     /**
index 3c92b53..9b6917c 100644 (file)
@@ -367,9 +367,12 @@ class FormViewHelperTest extends ViewHelperBaseTestcase
      */
     public function postProcessUriArgumentsForRequestHashWorks($arguments, $expectedResults)
     {
-        $viewHelper = $this->getAccessibleMock(FormViewHelper::class, ['dummy'], [], '', false);
+        $formViewHelper = new FormViewHelper();
         $results = [];
-        $viewHelper->_callRef('postProcessUriArgumentsForRequestHash', $arguments, $results);
+        $mock = \Closure::bind(static function (FormViewHelper $formViewHelper) use ($arguments, &$results) {
+            return $formViewHelper->postProcessUriArgumentsForRequestHash($arguments, $results);
+        }, null, FormViewHelper::class);
+        $mock($formViewHelper);
         self::assertEquals($expectedResults, $results);
     }
 }
index 65a61fb..d790903 100644 (file)
@@ -16,8 +16,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Link;
  */
 
 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
+use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
 use TYPO3\CMS\Fluid\ViewHelpers\Link\PageViewHelper;
-use TYPO3\TestingFramework\Fluid\Unit\Core\Rendering\RenderingContextFixture;
 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
 use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
 
@@ -61,7 +61,10 @@ class PageViewHelperTest extends ViewHelperBaseTestcase
         $this->controllerContext->expects(self::any())->method('getUriBuilder')->willReturn($this->uriBuilder);
         $this->controllerContext->expects(self::any())->method('getRequest')->willReturn($this->request->reveal());
         $this->arguments = [];
-        $this->renderingContext = $this->getAccessibleMock(RenderingContextFixture::class, ['getControllerContext']);
+        $this->renderingContext = $this->getMockBuilder(RenderingContext::class)
+            ->onlyMethods(['getControllerContext'])
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->renderingContext->expects(self::any())->method('getControllerContext')->willReturn($this->controllerContext);
         // until here
 
index 30128ff..e43f61e 100644 (file)
@@ -263,7 +263,7 @@ class TypoScriptFrontendControllerTest extends UnitTestCase
      */
     public function splitLinkVarsStringSplitsStringByComma($string, $expected)
     {
-        self::assertEquals($expected, $this->subject->_callRef('splitLinkVarsString', $string));
+        self::assertEquals($expected, $this->subject->_call('splitLinkVarsString', $string));
     }
 
     /**
index 40936fa..efc4932 100644 (file)
@@ -226,6 +226,6 @@ class DatabaseRecordListTest extends UnitTestCase
      */
     public function getVisibleColumns(array $tableTCA, string $type, string $expected)
     {
-        self::assertSame($expected, $this->subject->_callRef('getVisibleColumns', $tableTCA, $type));
+        self::assertSame($expected, $this->subject->_call('getVisibleColumns', $tableTCA, $type));
     }
 }