[TASK] Deprecate methods in ReflectionService 96/56896/13
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Wed, 9 May 2018 08:13:29 +0000 (10:13 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Tue, 12 Jun 2018 08:57:31 +0000 (10:57 +0200)
As the ReflectionService class is only a wrapper to call
methods on ClassSchema instances, all wrapper methods
should be deprecated and removed to make space for
a new, superior api.

Releases: master
Resolves: #85004
Change-Id: I7daabe1ab09c1c8a95b2b6dad2227c8859929dc0
Reviewed-on: https://review.typo3.org/56896
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
17 files changed:
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85004-DeprecateMethodsInReflectionService.rst [new file with mode: 0644]
typo3/sysext/extbase/Classes/Mvc/Cli/RequestBuilder.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Classes/Reflection/ReflectionService.php
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ActionControllerTest.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/ReflectionServiceTest.php [deleted file]
typo3/sysext/extbase/Tests/UnitDeprecated/Reflection/ReflectionServiceTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Validation/ValidatorResolverTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85004-DeprecateMethodsInReflectionService.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85004-DeprecateMethodsInReflectionService.rst
new file mode 100644 (file)
index 0000000..d6925c3
--- /dev/null
@@ -0,0 +1,46 @@
+.. include:: ../../Includes.txt
+
+============================================================
+Deprecation: #85004 - Deprecate methods in ReflectionService
+============================================================
+
+See :issue:`85004`
+
+Description
+===========
+
+The following methods within :php:`TYPO3\CMS\Extbase\Reflection\ReflectionService` have been marked
+as deprecated:
+
+* getClassTagsValues()
+* getClassTagValues()
+* getClassPropertyNames()
+* hasMethod()
+* getMethodTagsValues()
+* getMethodParameters()
+* getPropertyTagsValues()
+* getPropertyTagValues()
+* isClassTaggedWith()
+* isPropertyTaggedWith()
+
+
+Impact
+======
+
+Calling any of the deprecated methods above will trigger a PHP deprecation message.
+
+
+Affected Installations
+======================
+
+Any TYPO3 installation with a custom extension trying to gather reflection data via :php:`TYPO3\CMS\Extbase\Reflection\ReflectionService`
+
+
+Migration
+=========
+
+Instead of fetching reflection data via :php:`TYPO3\CMS\Extbase\Reflection\ReflectionService`, the needed data should
+directly be fetched from a :php:`TYPO3\CMS\Extbase\Reflection\ClassSchema` instance. An instance can be created by calling
+:php:`TYPO3\CMS\Extbase\Reflection\ReflectionService::getClassSchema()`.
+
+.. index:: FullyScanned, PHP-API, ext:extbase
index e56667a..716af45 100644 (file)
@@ -128,7 +128,9 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
         $commandLineArguments = [];
         $exceedingArguments = [];
         $commandMethodName = $controllerCommandName . 'Command';
-        $commandMethodParameters = $this->reflectionService->getMethodParameters($controllerObjectName, $commandMethodName);
+        $commandMethodParameters = $this->reflectionService
+            ->getClassSchema($controllerObjectName)
+            ->getMethod($commandMethodName)['params'] ?? [];
         $requiredArguments = [];
         $optionalArguments = [];
         $argumentNames = [];
index 0b7aa14..cde1cfd 100644 (file)
@@ -225,7 +225,10 @@ class ActionController extends AbstractController
      */
     protected function initializeActionMethodArguments()
     {
-        $methodParameters = $this->reflectionService->getMethodParameters(static::class, $this->actionMethodName);
+        $methodParameters = $this->reflectionService
+                ->getClassSchema(static::class)
+                ->getMethod($this->actionMethodName)['params'] ?? [];
+
         foreach ($methodParameters as $parameterName => $parameterInfo) {
             $dataType = null;
             if (isset($parameterInfo['type'])) {
index bfeb6c7..33b91d0 100644 (file)
@@ -162,7 +162,9 @@ class CommandController implements CommandControllerInterface
      */
     protected function initializeCommandMethodArguments()
     {
-        $methodParameters = $this->reflectionService->getMethodParameters(static::class, $this->commandMethodName);
+        $methodParameters = $this->reflectionService
+            ->getClassSchema(static::class)
+            ->getMethod($this->commandMethodName)['params'] ?? [];
 
         foreach ($methodParameters as $parameterName => $parameterInfo) {
             $dataType = null;
index 005b39b..235b46e 100644 (file)
@@ -121,15 +121,17 @@ class ObjectConverter extends AbstractTypeConverter
         }
 
         $specificTargetType = $this->objectContainer->getImplementationClassName($targetType);
-        if ($this->reflectionService->hasMethod($specificTargetType, \TYPO3\CMS\Extbase\Reflection\ObjectAccess::buildSetterMethodName($propertyName))) {
-            $methodParameters = $this->reflectionService->getMethodParameters($specificTargetType, \TYPO3\CMS\Extbase\Reflection\ObjectAccess::buildSetterMethodName($propertyName));
+        $classSchema = $this->reflectionService->getClassSchema($specificTargetType);
+
+        if ($classSchema->hasMethod(\TYPO3\CMS\Extbase\Reflection\ObjectAccess::buildSetterMethodName($propertyName))) {
+            $methodParameters = $classSchema->getMethod(\TYPO3\CMS\Extbase\Reflection\ObjectAccess::buildSetterMethodName($propertyName))['params'] ?? [];
             $methodParameter = current($methodParameters);
             if (!isset($methodParameter['type'])) {
                 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException('Setter for property "' . $propertyName . '" had no type hint or documentation in target object of type "' . $specificTargetType . '".', 1303379158);
             }
             return $methodParameter['type'];
         }
-        $methodParameters = $this->reflectionService->getMethodParameters($specificTargetType, '__construct');
+        $methodParameters = $classSchema->getMethod('__construct')['params'] ?? [];
         if (isset($methodParameters[$propertyName]) && isset($methodParameters[$propertyName]['type'])) {
             return $methodParameters[$propertyName]['type'];
         }
@@ -213,8 +215,10 @@ class ObjectConverter extends AbstractTypeConverter
     protected function buildObject(array &$possibleConstructorArgumentValues, $objectType)
     {
         $specificObjectType = $this->objectContainer->getImplementationClassName($objectType);
-        if ($this->reflectionService->hasMethod($specificObjectType, '__construct')) {
-            $constructorSignature = $this->reflectionService->getMethodParameters($specificObjectType, '__construct');
+        $classSchema = $this->reflectionService->getClassSchema($specificObjectType);
+
+        if ($classSchema->hasConstructor()) {
+            $constructorSignature = $classSchema->getMethod('__construct')['params'] ?? [];
             $constructorArguments = [];
             foreach ($constructorSignature as $constructorArgumentName => $constructorArgumentInformation) {
                 if (array_key_exists($constructorArgumentName, $possibleConstructorArgumentValues)) {
index b08de3d..80d4836 100644 (file)
@@ -36,7 +36,6 @@ use TYPO3\CMS\Extbase\Validation\ValidatorResolver;
 /**
  * A class schema
  *
- * @internal
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
 class ClassSchema
index 10d43d5..326dd2b 100644 (file)
@@ -85,9 +85,15 @@ class ReflectionService implements SingletonInterface
      *
      * @param string $className Name of the class
      * @return array An array of tags and their values or an empty array if no tags were found
+     * @deprecated
      */
     public function getClassTagsValues($className): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -103,9 +109,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class containing the property
      * @param string $tag Tag to return the values of
      * @return array An array of values or an empty array if the tag was not found
+     * @deprecated
      */
     public function getClassTagValues($className, $tag): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -120,9 +132,15 @@ class ReflectionService implements SingletonInterface
      *
      * @param string $className Name of the class to return the property names of
      * @return array An array of property names or an empty array if none exist
+     * @deprecated
      */
     public function getClassPropertyNames($className): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -155,9 +173,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class containing the method
      * @param string $methodName Name of the method
      * @return bool
+     * @deprecated
      */
     public function hasMethod($className, $methodName): bool
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -173,9 +197,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class containing the method
      * @param string $methodName Name of the method to return the tags and values of
      * @return array An array of tags and their values or an empty array of no tags were found
+     * @deprecated
      */
     public function getMethodTagsValues($className, $methodName): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -192,9 +222,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class containing the method
      * @param string $methodName Name of the method to return parameter information of
      * @return array An array of parameter names and additional information or an empty array of no parameters were found
+     * @deprecated
      */
     public function getMethodParameters($className, $methodName): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -210,9 +246,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class containing the property
      * @param string $propertyName Name of the property to return the tags and values of
      * @return array An array of tags and their values or an empty array of no tags were found
+     * @deprecated
      */
     public function getPropertyTagsValues($className, $propertyName): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -229,9 +271,15 @@ class ReflectionService implements SingletonInterface
      * @param string $propertyName Name of the tagged property
      * @param string $tag Tag to return the values of
      * @return array An array of values or an empty array if the tag was not found
+     * @deprecated
      */
     public function getPropertyTagValues($className, $propertyName, $tag): array
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -247,9 +295,15 @@ class ReflectionService implements SingletonInterface
      * @param string $className Name of the class
      * @param string $tag Tag to check for
      * @return bool TRUE if the class is tagged with $tag, otherwise FALSE
+     * @deprecated
      */
     public function isClassTaggedWith($className, $tag): bool
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
@@ -272,9 +326,15 @@ class ReflectionService implements SingletonInterface
      * @param string $propertyName Name of the property
      * @param string $tag Tag to check for
      * @return bool TRUE if the class property is tagged with $tag, otherwise FALSE
+     * @deprecated
      */
     public function isPropertyTaggedWith($className, $propertyName, $tag): bool
     {
+        trigger_error(
+            'Method ' . __METHOD__ . ' is deprecated and will be removed in TYPO3 v10.0.',
+            E_USER_DEPRECATED
+        );
+
         try {
             $classSchema = $this->getClassSchema($className);
         } catch (\Exception $e) {
index aece956..d8f34c1 100644 (file)
@@ -212,8 +212,11 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
         $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
         $controllerClassName = $command->getControllerClassName();
         $methodName = $command->getControllerCommandName() . 'Command';
-        $tags = $this->reflectionService->getMethodTagsValues($controllerClassName, $methodName);
-        foreach ($tags['param'] as $tag) {
+
+        $tags = $this->reflectionService
+                ->getClassSchema($controllerClassName)
+                ->getMethod($methodName)['tags']['param'] ?? [];
+        foreach ($tags as $tag) {
             list($argumentType, $argumentVariableName) = explode(' ', $tag);
             if (substr($argumentVariableName, 1) === $argument->getName()) {
                 return $argumentType;
@@ -260,7 +263,11 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
         $type = $this->getArgumentType($argument);
         $argumentName = $argument->getName();
         $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
-        $argumentReflection = $this->reflectionService->getMethodParameters($command->getControllerClassName(), $command->getControllerCommandName() . 'Command');
+
+        $argumentReflection = $this->reflectionService
+            ->getClassSchema($command->getControllerClassName())
+            ->getMethod($command->getControllerCommandName() . 'Command')['params'] ?? [];
+
         $defaultValue = $argumentReflection[$argumentName]['defaultValue'];
         if (TypeHandlingUtility::normalizeType($type) === 'boolean') {
             $defaultValue = (bool)$defaultValue ? 1 : 0;
index 4722fd5..048e049 100644 (file)
@@ -167,7 +167,9 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
         $validatorConjunctions = [];
 
         if ($methodParameters === null) {
-            $methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
+            $methodParameters = $this->reflectionService
+                ->getClassSchema($className)
+                ->getMethod($methodName)['params'] ?? [];
         }
         if (empty($methodParameters)) {
             return $validatorConjunctions;
@@ -553,7 +555,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
     public function getMethodValidateAnnotations($className, $methodName)
     {
         $validateAnnotations = [];
-        $methodTagsValues = $this->reflectionService->getMethodTagsValues($className, $methodName);
+        $methodTagsValues = $this->reflectionService->getClassSchema($className)->getMethod($methodName)['tags'] ?? [];
         if (isset($methodTagsValues['validate']) && is_array($methodTagsValues['validate'])) {
             foreach ($methodTagsValues['validate'] as $validateValue) {
                 $parsedAnnotations = $this->parseValidatorAnnotation($validateValue);
index fb28db9..32c9c8d 100644 (file)
@@ -21,6 +21,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException;
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
 
 /**
  * Test case
@@ -53,7 +54,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     protected $mockCommandManager;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
+     * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $mockReflectionService;
 
@@ -89,9 +90,14 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      *
      * @test
      */
-    public function cliAccessWithExtensionControllerAndActionNameBuildsCorrectRequest()
+    public function cliAccessWithExtensionControllerAndActionNameBuildsCorrectRequest(): void
     {
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->will($this->returnValue([]));
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => []
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list');
         $this->assertSame('Tx\\SomeExtensionName\\Command\\DefaultCommandController', $request->getControllerObjectName());
         $this->assertSame('list', $request->getControllerCommandName(), 'The CLI request specifying a package, controller and action name did not return a request object pointing to the expected action.');
@@ -123,12 +129,18 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function argumentWithValueSeparatedByEqualSignBuildsCorrectRequest()
+    public function argumentWithValueSeparatedByEqualSignBuildsCorrectRequest(): void
     {
         $methodParameters = [
             'testArgument' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value');
         $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
         $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
@@ -139,13 +151,19 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      *
      * @test
      */
-    public function cliAccessWithExtensionControllerActionAndArgumentsBuildsCorrectRequest()
+    public function cliAccessWithExtensionControllerActionAndArgumentsBuildsCorrectRequest(): void
     {
         $methodParameters = [
             'testArgument' => ['optional' => false, 'type' => 'string'],
             'testArgument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value --test-argument2=value2');
         $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
         $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
@@ -158,7 +176,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      *
      * @test
      */
-    public function checkIfCLIAccesWithPackageControllerActionAndArgumentsToleratesSpaces()
+    public function checkIfCLIAccesWithPackageControllerActionAndArgumentsToleratesSpaces(): void
     {
         $methodParameters = [
             'testArgument' => ['optional' => false, 'type' => 'string'],
@@ -166,7 +184,13 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'testArgument3' => ['optional' => false, 'type' => 'string'],
             'testArgument4' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument= value --test-argument2 =value2 --test-argument3 = value3 --test-argument4=value4');
         $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
         $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
@@ -183,14 +207,21 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      *
      * @test
      */
-    public function CLIAccesWithShortArgumentsBuildsCorrectRequest()
+    public function CLIAccesWithShortArgumentsBuildsCorrectRequest(): void
     {
         $methodParameters = [
             'a' => ['optional' => false, 'type' => 'string'],
             'd' => ['optional' => false, 'type' => 'string'],
             'f' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $request = $this->requestBuilder->build('some_extension_name:default:list -d valued -f=valuef -a = valuea');
         $this->assertTrue($request->hasArgument('d'), 'The given "d" was not found in the built request.');
         $this->assertTrue($request->hasArgument('f'), 'The given "f" was not found in the built request.');
@@ -206,7 +237,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      *
      * @test
      */
-    public function CLIAccesWithArgumentsWithAndWithoutValuesBuildsCorrectRequest()
+    public function CLIAccesWithArgumentsWithAndWithoutValuesBuildsCorrectRequest(): void
     {
         $methodParameters = [
             'testArgument' => ['optional' => false, 'type' => 'string'],
@@ -224,7 +255,14 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'k' => ['optional' => false, 'type' => 'string'],
             'm' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument=value --test-argument2= value2 -k --test-argument-3 = value3 --test-argument4=value4 -f valuef -d=valued -a = valuea -c --testArgument7 --test-argument5 = 5 --test-argument6 -j kjk -m');
         $this->assertTrue($request->hasArgument('testArgument'), 'The given "testArgument" was not found in the built request.');
         $this->assertTrue($request->hasArgument('testArgument2'), 'The given "testArgument2" was not found in the built request.');
@@ -254,13 +292,19 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function insteadOfNamedArgumentsTheArgumentsCanBePassedUnnamedInTheCorrectOrder()
+    public function insteadOfNamedArgumentsTheArgumentsCanBePassedUnnamedInTheCorrectOrder(): void
     {
         $methodParameters = [
             'testArgument1' => ['optional' => false, 'type' => 'string'],
             'testArgument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->exactly(2))->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument1 firstArgumentValue --test-argument2 secondArgumentValue');
         $this->assertSame('firstArgumentValue', $request->getArgument('testArgument1'));
         $this->assertSame('secondArgumentValue', $request->getArgument('testArgument2'));
@@ -272,7 +316,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function argumentsAreDetectedAfterOptions()
+    public function argumentsAreDetectedAfterOptions(): void
     {
         $methodParameters = [
             'some' => ['optional' => true, 'type' => 'boolean'],
@@ -280,7 +324,13 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'argument1' => ['optional' => false, 'type' => 'string'],
             'argument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
         $request = $this->requestBuilder->build('some_extension_name:default:list --some -option=value file1 file2');
         $this->assertSame('list', $request->getControllerCommandName());
         $this->assertTrue($request->getArgument('some'));
@@ -291,13 +341,20 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function exceedingArgumentsMayBeSpecified()
+    public function exceedingArgumentsMayBeSpecified(): void
     {
         $methodParameters = [
             'testArgument1' => ['optional' => false, 'type' => 'string'],
             'testArgument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $expectedArguments = ['testArgument1' => 'firstArgumentValue', 'testArgument2' => 'secondArgumentValue'];
         $request = $this->requestBuilder->build('some_extension_name:default:list --test-argument1=firstArgumentValue --test-argument2 secondArgumentValue exceedingArgument1');
         $this->assertEquals($expectedArguments, $request->getArguments());
@@ -307,7 +364,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed()
+    public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed(): void
     {
         $this->expectException(InvalidArgumentMixingException::class);
         $this->expectExceptionCode(1309971820);
@@ -315,14 +372,21 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'testArgument1' => ['optional' => false, 'type' => 'string'],
             'testArgument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $this->requestBuilder->build('some_extension_name:default:list --test-argument1 firstArgumentValue secondArgumentValue');
     }
 
     /**
      * @test
      */
-    public function ifUnnamedArgumentsAreUsedAllRequiredArgumentsMustBeUnnamed()
+    public function ifUnnamedArgumentsAreUsedAllRequiredArgumentsMustBeUnnamed(): void
     {
         $this->expectException(InvalidArgumentMixingException::class);
         $this->expectExceptionCode(1309971821);
@@ -330,21 +394,35 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'requiredArgument1' => ['optional' => false, 'type' => 'string'],
             'requiredArgument2' => ['optional' => false, 'type' => 'string']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $this->requestBuilder->build('some_extension_name:default:list firstArgumentValue --required-argument2 secondArgumentValue');
     }
 
     /**
      * @test
      */
-    public function booleanOptionsAreConsideredEvenIfAnUnnamedArgumentFollows()
+    public function booleanOptionsAreConsideredEvenIfAnUnnamedArgumentFollows(): void
     {
         $methodParameters = [
             'requiredArgument1' => ['optional' => false, 'type' => 'string'],
             'requiredArgument2' => ['optional' => false, 'type' => 'string'],
             'booleanOption' => ['optional' => true, 'type' => 'boolean']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $expectedArguments = ['requiredArgument1' => 'firstArgumentValue', 'requiredArgument2' => 'secondArgumentValue', 'booleanOption' => true];
         $request = $this->requestBuilder->build('some_extension_name:default:list --booleanOption firstArgumentValue secondArgumentValue');
         $this->assertEquals($expectedArguments, $request->getArguments());
@@ -353,7 +431,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign()
+    public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign(): void
     {
         $methodParameters = [
             'b1' => ['optional' => true, 'type' => 'boolean'],
@@ -363,7 +441,14 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             'b5' => ['optional' => true, 'type' => 'boolean'],
             'b6' => ['optional' => true, 'type' => 'boolean']
         ];
-        $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('listCommand')->willReturn([
+            'params' => $methodParameters
+        ]);
+
+        $this->mockReflectionService->expects($this->any())->method('getClassSchema')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController')->willReturn($classSchemaMock);
+
         $expectedArguments = ['b1' => true, 'b2' => true, 'b3' => true, 'b4' => false, 'b5' => false, 'b6' => false];
         $request = $this->requestBuilder->build('some_extension_name:default:list --b2 y --b1 1 --b3 true --b4 false --b5 n --b6 0');
         $this->assertEquals($expectedArguments, $request->getArguments());
index 5d93f4e..320281e 100644 (file)
@@ -27,6 +27,7 @@ use TYPO3\CMS\Extbase\Mvc\RequestInterface;
 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
 use TYPO3\CMS\Extbase\Reflection\ReflectionService;
 use TYPO3\CMS\Fluid\View\TemplateView;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
@@ -155,7 +156,7 @@ class ActionControllerTest extends UnitTestCase
     /**
      * @test
      */
-    public function initializeActionMethodArgumentsRegistersArgumentsFoundInTheSignatureOfTheCurrentActionMethod()
+    public function initializeActionMethodArgumentsRegistersArgumentsFoundInTheSignatureOfTheCurrentActionMethod(): void
     {
         $mockRequest = $this->createMock(Request::class);
         $mockArguments = $this->getMockBuilder(Arguments::class)
@@ -194,8 +195,22 @@ class ActionControllerTest extends UnitTestCase
                 'hasDefaultValue' => false
             ]
         ];
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('fooAction')
+            ->willReturn([
+                'params' => $methodParameters
+            ]);
+
         $mockReflectionService = $this->createMock(ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(get_class($mockController))
+            ->willReturn($classSchemaMock);
         $mockController->_set('reflectionService', $mockReflectionService);
         $mockController->_set('request', $mockRequest);
         $mockController->_set('arguments', $mockArguments);
@@ -206,7 +221,7 @@ class ActionControllerTest extends UnitTestCase
     /**
      * @test
      */
-    public function initializeActionMethodArgumentsRegistersOptionalArgumentsAsSuch()
+    public function initializeActionMethodArgumentsRegistersOptionalArgumentsAsSuch(): void
     {
         $mockRequest = $this->createMock(Request::class);
         $mockArguments = $this->createMock(Arguments::class);
@@ -244,8 +259,22 @@ class ActionControllerTest extends UnitTestCase
                 'hasDefaultValue' => true
             ]
         ];
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('fooAction')
+            ->willReturn([
+                'params' => $methodParameters
+            ]);
+
         $mockReflectionService = $this->createMock(ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(get_class($mockController))
+            ->willReturn($classSchemaMock);
         $mockController->_set('reflectionService', $mockReflectionService);
         $mockController->_set('request', $mockRequest);
         $mockController->_set('arguments', $mockArguments);
@@ -256,7 +285,7 @@ class ActionControllerTest extends UnitTestCase
     /**
      * @test
      */
-    public function initializeActionMethodArgumentsThrowsExceptionIfDataTypeWasNotSpecified()
+    public function initializeActionMethodArgumentsThrowsExceptionIfDataTypeWasNotSpecified(): void
     {
         $this->expectException(InvalidArgumentTypeException::class);
         $this->expectExceptionCode(1253175643);
@@ -272,8 +301,22 @@ class ActionControllerTest extends UnitTestCase
                 'allowsNull' => false
             ]
         ];
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('fooAction')
+            ->willReturn([
+                'params' => $methodParameters
+            ]);
+
         $mockReflectionService = $this->createMock(ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(get_class($mockController))
+            ->willReturn($classSchemaMock);
         $mockController->_set('reflectionService', $mockReflectionService);
         $mockController->_set('request', $mockRequest);
         $mockController->_set('arguments', $mockArguments);
index 2654ec5..d8db887 100644 (file)
@@ -22,6 +22,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter;
  *                                                                        */
 use TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration;
 use TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter;
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
 
 /**
  * Test case
@@ -103,15 +104,24 @@ class ObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     /**
      * @test
      */
-    public function getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType()
+    public function getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType(): void
     {
-        $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(false));
-        $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue([
-            'thePropertyName' => [
-                'type' => 'TheTypeOfSubObject',
-                'elementType' => null
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with('__construct')->willReturn([
+            'params' => [
+                'thePropertyName' => [
+                    'type' => 'TheTypeOfSubObject',
+                    'elementType' => null
+                ]
             ]
-        ]));
+        ]);
+
+        $this->mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with('TheTargetType')
+            ->willReturn($classSchemaMock);
+
         $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue('TheTargetType'));
 
         $configuration = new PropertyMappingConfiguration();
index a289057..d8a2964 100644 (file)
@@ -25,6 +25,7 @@ use TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationExce
 use TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException;
 use TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException;
 use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter;
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\PersistentObjectEntityFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\PersistentObjectFixture;
 use TYPO3\CMS\Extbase\Tests\Unit\Property\TypeConverter\Fixtures\PersistentObjectValueObjectFixture;
@@ -374,8 +375,30 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un
     /**
      * @test
      */
-    public function convertFromShouldCreateObjectWhenThereAreConstructorParameters()
+    public function convertFromShouldCreateObjectWhenThereAreConstructorParameters(): void
     {
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('__construct')
+            ->willReturn([
+            'params' => [
+                'property1' => ['optional' => false]
+            ]
+        ]);
+
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('hasConstructor')
+            ->willReturn(true);
+
+        $this->mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class)
+            ->willReturn($classSchemaMock);
+
         $source = [
             'propertyX' => 'bar'
         ];
@@ -386,18 +409,6 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un
         $expectedObject = new \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor('param1');
         $expectedObject->setProperty2('bar');
 
-        $this->mockReflectionService
-                ->expects($this->any())
-                ->method('getMethodParameters')
-                ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')
-                ->will($this->returnValue([
-                    'property1' => ['optional' => false]
-                ]));
-        $this->mockReflectionService
-                ->expects($this->any())
-                ->method('hasMethod')
-                ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')
-                ->will($this->returnValue(true));
         $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class));
         $configuration = $this->buildConfiguration([PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true]);
         $result = $this->converter->convertFrom($source, \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, $convertedChildProperties, $configuration);
@@ -410,19 +421,33 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un
      */
     public function convertFromShouldCreateObjectWhenThereAreOptionalConstructorParameters()
     {
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('__construct')
+            ->willReturn([
+                'params' => [
+                    'property1' => ['optional' => true, 'defaultValue' => 'thisIsTheDefaultValue']
+                ]
+            ]);
+
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('hasConstructor')
+            ->willReturn(true);
+
+        $this->mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class)
+            ->willReturn($classSchemaMock);
+
         $source = [
             'propertyX' => 'bar'
         ];
         $expectedObject = new \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor('thisIsTheDefaultValue');
 
-        $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue([
-            'property1' => ['optional' => true, 'defaultValue' => 'thisIsTheDefaultValue']
-        ]));
-        $this->mockReflectionService
-                ->expects($this->any())
-                ->method('hasMethod')
-                ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')
-                ->will($this->returnValue(true));
         $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class));
         $configuration = $this->buildConfiguration([PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true]);
         $result = $this->converter->convertFrom($source, \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, [], $configuration);
@@ -432,8 +457,30 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un
     /**
      * @test
      */
-    public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound()
+    public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound(): void
     {
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('getMethod')
+            ->with('__construct')
+            ->willReturn([
+                'params' => [
+                    'property1' => ['optional' => false]
+                ]
+            ]);
+
+        $classSchemaMock
+            ->expects($this->any())
+            ->method('hasConstructor')
+            ->willReturn(true);
+
+        $this->mockReflectionService
+            ->expects($this->any())
+            ->method('getClassSchema')
+            ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class)
+            ->willReturn($classSchemaMock);
+
         $this->expectException(InvalidTargetException::class);
         $this->expectExceptionCode(1268734872);
         $source = [
@@ -444,14 +491,6 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un
             'property2' => 'bar'
         ];
 
-        $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue([
-            'property1' => ['optional' => false]
-        ]));
-        $this->mockReflectionService
-                ->expects($this->any())
-                ->method('hasMethod')
-                ->with(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, '__construct')
-                ->will($this->returnValue(true));
         $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue(\TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class));
         $configuration = $this->buildConfiguration([PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true]);
         $result = $this->converter->convertFrom($source, \TYPO3\CMS\Extbase\Tests\Fixture\ClassWithSettersAndConstructor::class, $convertedChildProperties, $configuration);
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php
deleted file mode 100644 (file)
index 310e53f..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Extbase\Reflection\ReflectionService;
-
-/**
- * Test case
- * @see test for reflection
- * @link second test for reflection
- * @link second test for reflection with second value
- */
-class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
-     * @param array $foo The foo parameter
-     * @return string
-     */
-    public function fixtureMethodForMethodTagsValues(array $foo)
-    {
-    }
-
-    /**
-     * @param bool $dummy
-     * @param int $foo
-     */
-    public function fixtureMethodForMethodTagsValuesWithShortTypes($dummy, $foo)
-    {
-    }
-
-    /**
-     * @test
-     */
-    public function getClassTagsValues()
-    {
-        $service = new ReflectionService();
-        $classValues = $service->getClassTagsValues(static::class);
-        $this->assertEquals([
-            'see' => ['test for reflection'],
-            'link' => ['second test for reflection', 'second test for reflection with second value']
-        ], $classValues);
-
-        $this->assertEquals(
-            [],
-            $service->getClassTagsValues('NonExistantNamespace\\NonExistantClass')
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function getClassTagValues()
-    {
-        $service = new ReflectionService();
-        $classValues = $service->getClassTagValues(static::class, 'see');
-        $this->assertEquals([
-            'test for reflection',
-        ], $classValues);
-
-        $this->assertEquals(
-            [],
-            $service->getClassTagValues(static::class, 'nonExistantTag')
-        );
-
-        $this->assertEquals(
-            [],
-            $service->getClassTagValues('NonExistantNamespace\\NonExistantClass', 'nonExistantTag')
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function hasMethod()
-    {
-        $service = new ReflectionService();
-        $this->assertTrue($service->hasMethod(static::class, 'fixtureMethodForMethodTagsValues'));
-        $this->assertFalse($service->hasMethod(static::class, 'notExistentMethod'));
-        $this->assertFalse($service->hasMethod('NonExistantNamespace\\NonExistantClass', 'notExistentMethod'));
-    }
-
-    /**
-     * @test
-     */
-    public function getMethodTagsValues()
-    {
-        $service = new ReflectionService();
-        $tagsValues = $service->getMethodTagsValues(static::class, 'fixtureMethodForMethodTagsValues');
-        $this->assertEquals([
-            'param' => ['array $foo The foo parameter'],
-            'return' => ['string']
-        ], $tagsValues);
-
-        $this->assertEquals(
-            [],
-            $service->getMethodTagsValues(static::class, 'notExistentMethod')
-        );
-
-        $this->assertEquals(
-            [],
-            $service->getMethodTagsValues('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function getMethodParameters()
-    {
-        $service = new ReflectionService();
-        $parameters = $service->getMethodParameters(static::class, 'fixtureMethodForMethodTagsValues');
-        $this->assertSame([
-            'foo' => [
-                'position' => 0,
-                'byReference' => false,
-                'array' => true,
-                'optional' => false,
-                'allowsNull' => false,
-                'class' => null,
-                'type' => 'array',
-                'nullable' => false,
-                'default' =>  null,
-                'hasDefaultValue' =>  false,
-                'defaultValue' =>  null,
-                'dependency' =>  null,
-                'validators' => [],
-            ]
-        ], $parameters);
-
-        $this->assertSame(
-            [],
-            $service->getMethodParameters(static::class, 'notExistentMethod')
-        );
-
-        $this->assertSame(
-            [],
-            $service->getMethodParameters('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function getMethodParametersWithShortTypeNames()
-    {
-        $service = new ReflectionService();
-        $parameters = $service->getMethodParameters(static::class, 'fixtureMethodForMethodTagsValuesWithShortTypes');
-        $this->assertSame([
-            'dummy' => [
-                'position' => 0,
-                'byReference' => false,
-                'array' => false,
-                'optional' => false,
-                'allowsNull' => true,
-                'class' => null,
-                'type' => 'boolean',
-                'nullable' => true,
-                'default' =>  null,
-                'hasDefaultValue' =>  false,
-                'defaultValue' =>  null,
-                'dependency' =>  null,
-                'validators' => [],
-            ],
-            'foo' => [
-                'position' => 1,
-                'byReference' => false,
-                'array' => false,
-                'optional' => false,
-                'allowsNull' => true,
-                'class' => null,
-                'type' => 'integer',
-                'nullable' => true,
-                'default' =>  null,
-                'hasDefaultValue' =>  false,
-                'defaultValue' =>  null,
-                'dependency' =>  null,
-                'validators' => [],
-            ]
-        ], $parameters);
-    }
-
-    public function testIsClassTaggedWith()
-    {
-        $service = new ReflectionService();
-        $this->assertTrue($service->isClassTaggedWith(
-            Fixture\DummyClassWithTags::class,
-            'see'
-        ));
-
-        $this->assertFalse($service->isClassTaggedWith(
-            Fixture\DummyClassWithAllTypesOfProperties::class,
-            'bar'
-        ));
-
-        $this->assertFalse($service->isClassTaggedWith(
-            'NonExistantNamespace\\NonExistantClass',
-            'foo'
-        ));
-    }
-
-    public function testIsPropertyTaggedWith()
-    {
-        $service = new ReflectionService();
-        $this->assertTrue($service->isPropertyTaggedWith(
-            Fixture\DummyClassWithAllTypesOfProperties::class,
-            'propertyWithInjectAnnotation',
-            'extbase\inject'
-        ));
-
-        $this->assertFalse($service->isPropertyTaggedWith(
-            Fixture\DummyClassWithAllTypesOfProperties::class,
-            'propertyWithInjectAnnotation',
-            'foo'
-        ));
-
-        $this->assertFalse($service->isPropertyTaggedWith(
-            Fixture\DummyClassWithAllTypesOfProperties::class,
-            'nonExistantProperty',
-            'foo'
-        ));
-
-        $this->assertFalse($service->isPropertyTaggedWith(
-            'NonExistantNamespace\\NonExistantClass',
-            'propertyWithInjectAnnotation',
-            'extbase\inject'
-        ));
-    }
-
-    public function testgetPropertyTagValues()
-    {
-        $service = new ReflectionService();
-        $this->assertSame(
-            [],
-            $service->getPropertyTagValues(
-                Fixture\DummyClassWithAllTypesOfProperties::class,
-                'propertyWithInjectAnnotation',
-                'foo'
-            )
-        );
-
-        $this->assertSame(
-            [],
-            $service->getPropertyTagValues(
-            Fixture\DummyClassWithAllTypesOfProperties::class,
-            'propertyWithInjectAnnotation',
-            'inject'
-            )
-        );
-    }
-
-    public function testGetPropertyTagsValues()
-    {
-        $service = new ReflectionService();
-        $this->assertSame(
-            [
-                'extbase\inject' => [],
-                'var' => [
-                    'DummyClassWithAllTypesOfProperties'
-                ]
-            ],
-            $service->getPropertyTagsValues(
-                Fixture\DummyClassWithAllTypesOfProperties::class,
-                'propertyWithInjectAnnotation'
-            )
-        );
-
-        $this->assertSame(
-            [],
-            $service->getPropertyTagsValues(
-                Fixture\DummyClassWithAllTypesOfProperties::class,
-                'nonExistantProperty'
-            )
-        );
-
-        $this->assertSame(
-            [],
-            $service->getPropertyTagsValues(
-                'NonExistantNamespace\\NonExistantClass',
-                'nonExistantProperty'
-            )
-        );
-    }
-
-    public function testGetClassPropertyNames()
-    {
-        $service = new ReflectionService();
-        $this->assertSame(
-            [
-                'publicProperty',
-                'protectedProperty',
-                'privateProperty',
-                'publicStaticProperty',
-                'protectedStaticProperty',
-                'privateStaticProperty',
-                'propertyWithIgnoredTags',
-                'propertyWithInjectAnnotation',
-                'propertyWithTransientAnnotation',
-                'propertyWithCascadeAnnotation',
-                'propertyWithCascadeAnnotationWithoutVarAnnotation',
-                'propertyWithObjectStorageAnnotation'
-            ],
-            $service->getClassPropertyNames(Fixture\DummyClassWithAllTypesOfProperties::class)
-        );
-
-        $this->assertSame(
-            [],
-            $service->getClassPropertyNames('NonExistantNamespace\\NonExistantClass')
-        );
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Reflection/ReflectionServiceTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Reflection/ReflectionServiceTest.php
new file mode 100644 (file)
index 0000000..ea69825
--- /dev/null
@@ -0,0 +1,330 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Extbase\Reflection\ReflectionService;
+
+/**
+ * Test case
+ * @see test for reflection
+ * @link second test for reflection
+ * @link second test for reflection with second value
+ */
+class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * Subject is not notice free, disable E_NOTICES
+     */
+    protected static $suppressNotices = true;
+
+    /**
+     * @param array $foo The foo parameter
+     * @return string
+     */
+    public function fixtureMethodForMethodTagsValues(array $foo): string
+    {
+        return '';
+    }
+
+    /**
+     * @param bool $dummy
+     * @param int $foo
+     */
+    public function fixtureMethodForMethodTagsValuesWithShortTypes($dummy, $foo): void
+    {
+    }
+
+    /**
+     * @test
+     */
+    public function getClassTagsValues(): void
+    {
+        $service = new ReflectionService();
+        $classValues = $service->getClassTagsValues(static::class);
+        $this->assertEquals([
+            'see' => ['test for reflection'],
+            'link' => ['second test for reflection', 'second test for reflection with second value']
+        ], $classValues);
+
+        $this->assertEquals(
+            [],
+            $service->getClassTagsValues('NonExistantNamespace\\NonExistantClass')
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function getClassTagValues(): void
+    {
+        $service = new ReflectionService();
+        $classValues = $service->getClassTagValues(static::class, 'see');
+        $this->assertEquals([
+            'test for reflection',
+        ], $classValues);
+
+        $this->assertEquals(
+            [],
+            $service->getClassTagValues(static::class, 'nonExistantTag')
+        );
+
+        $this->assertEquals(
+            [],
+            $service->getClassTagValues('NonExistantNamespace\\NonExistantClass', 'nonExistantTag')
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function hasMethod(): void
+    {
+        $service = new ReflectionService();
+        $this->assertTrue($service->hasMethod(static::class, 'fixtureMethodForMethodTagsValues'));
+        $this->assertFalse($service->hasMethod(static::class, 'notExistentMethod'));
+        $this->assertFalse($service->hasMethod('NonExistantNamespace\\NonExistantClass', 'notExistentMethod'));
+    }
+
+    /**
+     * @test
+     */
+    public function getMethodTagsValues(): void
+    {
+        $service = new ReflectionService();
+        $tagsValues = $service->getMethodTagsValues(static::class, 'fixtureMethodForMethodTagsValues');
+        $this->assertEquals([
+            'param' => ['array $foo The foo parameter'],
+            'return' => ['string']
+        ], $tagsValues);
+
+        $this->assertEquals(
+            [],
+            $service->getMethodTagsValues(static::class, 'notExistentMethod')
+        );
+
+        $this->assertEquals(
+            [],
+            $service->getMethodTagsValues('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function getMethodParameters(): void
+    {
+        $service = new ReflectionService();
+        $parameters = $service->getMethodParameters(static::class, 'fixtureMethodForMethodTagsValues');
+        $this->assertSame([
+            'foo' => [
+                'position' => 0,
+                'byReference' => false,
+                'array' => true,
+                'optional' => false,
+                'allowsNull' => false,
+                'class' => null,
+                'type' => 'array',
+                'nullable' => false,
+                'default' =>  null,
+                'hasDefaultValue' =>  false,
+                'defaultValue' =>  null,
+                'dependency' =>  null,
+                'validators' => [],
+            ]
+        ], $parameters);
+
+        $this->assertSame(
+            [],
+            $service->getMethodParameters(static::class, 'notExistentMethod')
+        );
+
+        $this->assertSame(
+            [],
+            $service->getMethodParameters('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
+        );
+    }
+
+    /**
+     * @test
+     */
+    public function getMethodParametersWithShortTypeNames(): void
+    {
+        $service = new ReflectionService();
+        $parameters = $service->getMethodParameters(static::class, 'fixtureMethodForMethodTagsValuesWithShortTypes');
+        $this->assertSame([
+            'dummy' => [
+                'position' => 0,
+                'byReference' => false,
+                'array' => false,
+                'optional' => false,
+                'allowsNull' => true,
+                'class' => null,
+                'type' => 'boolean',
+                'nullable' => true,
+                'default' =>  null,
+                'hasDefaultValue' =>  false,
+                'defaultValue' =>  null,
+                'dependency' =>  null,
+                'validators' => [],
+            ],
+            'foo' => [
+                'position' => 1,
+                'byReference' => false,
+                'array' => false,
+                'optional' => false,
+                'allowsNull' => true,
+                'class' => null,
+                'type' => 'integer',
+                'nullable' => true,
+                'default' =>  null,
+                'hasDefaultValue' =>  false,
+                'defaultValue' =>  null,
+                'dependency' =>  null,
+                'validators' => [],
+            ]
+        ], $parameters);
+    }
+
+    public function testIsClassTaggedWith(): void
+    {
+        $service = new ReflectionService();
+        $this->assertTrue($service->isClassTaggedWith(
+            Fixture\DummyClassWithTags::class,
+            'see'
+        ));
+
+        $this->assertFalse($service->isClassTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'bar'
+        ));
+
+        $this->assertFalse($service->isClassTaggedWith(
+            'NonExistantNamespace\\NonExistantClass',
+            'foo'
+        ));
+    }
+
+    public function testIsPropertyTaggedWith(): void
+    {
+        $service = new ReflectionService();
+        $this->assertTrue($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'propertyWithInjectAnnotation',
+            'extbase\inject'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'propertyWithInjectAnnotation',
+            'foo'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'nonExistantProperty',
+            'foo'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            'NonExistantNamespace\\NonExistantClass',
+            'propertyWithInjectAnnotation',
+            'extbase\inject'
+        ));
+    }
+
+    public function testgetPropertyTagValues(): void
+    {
+        $service = new ReflectionService();
+        $this->assertSame(
+            [],
+            $service->getPropertyTagValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'propertyWithInjectAnnotation',
+                'foo'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'propertyWithInjectAnnotation',
+                'inject'
+            )
+        );
+    }
+
+    public function testGetPropertyTagsValues(): void
+    {
+        $service = new ReflectionService();
+        $this->assertSame(
+            [
+                'extbase\inject' => [],
+                'var' => [
+                    'DummyClassWithAllTypesOfProperties'
+                ]
+            ],
+            $service->getPropertyTagsValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'propertyWithInjectAnnotation'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagsValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'nonExistantProperty'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagsValues(
+                'NonExistantNamespace\\NonExistantClass',
+                'nonExistantProperty'
+            )
+        );
+    }
+
+    public function testGetClassPropertyNames(): void
+    {
+        $service = new ReflectionService();
+        $this->assertSame(
+            [
+                'publicProperty',
+                'protectedProperty',
+                'privateProperty',
+                'publicStaticProperty',
+                'protectedStaticProperty',
+                'privateStaticProperty',
+                'propertyWithIgnoredTags',
+                'propertyWithInjectAnnotation',
+                'propertyWithTransientAnnotation',
+                'propertyWithCascadeAnnotation',
+                'propertyWithCascadeAnnotationWithoutVarAnnotation',
+                'propertyWithObjectStorageAnnotation'
+            ],
+            $service->getClassPropertyNames(Fixture\DummyClassWithAllTypesOfProperties::class)
+        );
+
+        $this->assertSame(
+            [],
+            $service->getClassPropertyNames('NonExistantNamespace\\NonExistantClass')
+        );
+    }
+}
index 2fe4b45..2a90cc7 100644 (file)
@@ -15,7 +15,9 @@ namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Validation;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
 use TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationConfigurationException;
+use TYPO3\CMS\Extbase\Validation\ValidatorResolver;
 
 /**
  * Test case
@@ -38,12 +40,22 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
     public function buildMethodArgumentsValidatorConjunctionsReturnsEmptyArrayIfMethodHasNoArguments()
     {
         $mockController = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\ActionController::class, ['fooAction'], [], '', false);
-        $methodParameters = [];
+        $className = get_class($mockController);
+        $methodName = 'fooAction';
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with($methodName)->willReturn([
+            'params' => [],
+        ]);
+
         $mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService->expects($this->any())->method('getClassSchema')->with($className)->willReturn($classSchemaMock);
+
+        /** @var ValidatorResolver|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $validatorResolver */
         $validatorResolver = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Validation\ValidatorResolver::class, ['createValidator']);
         $validatorResolver->_set('reflectionService', $mockReflectionService);
-        $result = $validatorResolver->buildMethodArgumentsValidatorConjunctions(get_class($mockController), 'fooAction');
+
+        $result = $validatorResolver->buildMethodArgumentsValidatorConjunctions($className, $methodName);
         $this->assertSame([], $result);
     }
 
@@ -56,6 +68,10 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
             ->setMethods(['fooMethod'])
             ->disableOriginalConstructor()
             ->getMock();
+
+        $className = get_class($mockObject);
+        $methodName = 'fooAction';
+
         $methodParameters = [
             'arg1' => [
                 'type' => 'string'
@@ -74,9 +90,16 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
                 '$arg2 VENDOR\\ModelCollection\\Domain\\Model\\Model'
             ]
         ];
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with($methodName)->willReturn([
+            'params' => $methodParameters,
+            'tags' => $methodTagsValues
+        ]);
+
         $mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodTagsValues));
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService->expects($this->any())->method('getClassSchema')->with($className)->willReturn($classSchemaMock);
+
         $mockStringValidator = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class);
         $mockArrayValidator = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class);
         $mockFooValidator = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class);
@@ -92,6 +115,8 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $mockArguments = new \TYPO3\CMS\Extbase\Mvc\Controller\Arguments();
         $mockArguments->addArgument(new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('arg1', 'dummyValue'));
         $mockArguments->addArgument(new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('arg2', 'dummyValue'));
+
+        /** @var ValidatorResolver|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $validatorResolver */
         $validatorResolver = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Validation\ValidatorResolver::class, ['createValidator']);
         $validatorResolver->expects($this->at(0))->method('createValidator')->with(\TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator::class)->will($this->returnValue($conjunction1));
         $validatorResolver->expects($this->at(1))->method('createValidator')->with('string')->will($this->returnValue($mockStringValidator));
@@ -101,7 +126,8 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $validatorResolver->expects($this->at(5))->method('createValidator')->with('Bar')->will($this->returnValue($mockBarValidator));
         $validatorResolver->expects($this->at(6))->method('createValidator')->with('VENDOR\\ModelCollection\\Domain\\Model\\Model')->will($this->returnValue($mockQuuxValidator));
         $validatorResolver->_set('reflectionService', $mockReflectionService);
-        $result = $validatorResolver->buildMethodArgumentsValidatorConjunctions(get_class($mockObject), 'fooAction');
+
+        $result = $validatorResolver->buildMethodArgumentsValidatorConjunctions($className, $methodName);
         $this->assertEquals(['arg1' => $conjunction1, 'arg2' => $conjunction2], $result);
     }
 
@@ -116,6 +142,10 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
             ->setMethods(['fooMethod'])
             ->disableOriginalConstructor()
             ->getMock();
+
+        $className = get_class($mockObject);
+        $methodName = 'fooAction';
+
         $methodParameters = [
             'arg1' => [
                 'type' => 'string'
@@ -129,19 +159,28 @@ class ValidatorResolverTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
                 '$arg2 VENDOR\\ModelCollection\\Domain\\Model\\Model'
             ]
         ];
+
+        $classSchemaMock = $this->createMock(ClassSchema::class);
+        $classSchemaMock->expects($this->any())->method('getMethod')->with($methodName)->willReturn([
+            'params' => $methodParameters,
+            'tags' => $methodTagsValues
+        ]);
+
         $mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-        $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodTagsValues));
-        $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodParameters));
+        $mockReflectionService->expects($this->any())->method('getClassSchema')->with($className)->willReturn($classSchemaMock);
+
         $mockStringValidator = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class);
         $mockQuuxValidator = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::class);
         $conjunction1 = $this->createMock(\TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator::class);
         $conjunction1->expects($this->at(0))->method('addValidator')->with($mockStringValidator);
+
+        /** @var ValidatorResolver|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $validatorResolver */
         $validatorResolver = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Validation\ValidatorResolver::class, ['createValidator']);
         $validatorResolver->expects($this->at(0))->method('createValidator')->with(\TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator::class)->will($this->returnValue($conjunction1));
         $validatorResolver->expects($this->at(1))->method('createValidator')->with('string')->will($this->returnValue($mockStringValidator));
         $validatorResolver->expects($this->at(2))->method('createValidator')->with('VENDOR\\ModelCollection\\Domain\\Model\\Model')->will($this->returnValue($mockQuuxValidator));
         $validatorResolver->_set('reflectionService', $mockReflectionService);
-        $validatorResolver->buildMethodArgumentsValidatorConjunctions(get_class($mockObject), 'fooAction');
+        $validatorResolver->buildMethodArgumentsValidatorConjunctions($className, $methodName);
     }
 
     /**
index 60266cd..847c2d5 100644 (file)
@@ -2333,4 +2333,74 @@ return [
             'Deprecation-85130-TSFE-getPageShortcutMovedToPageRepository.rst',
         ],
     ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getClassTagsValues' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getClassTagValues' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getClassPropertyNames' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->hasMethod' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getMethodTagsValues' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getMethodParameters' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getPropertyTagsValues' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->getPropertyTagValues' => [
+        'numberOfMandatoryArguments' => 3,
+        'maximumNumberOfArguments' => 3,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->isClassTaggedWith' => [
+        'numberOfMandatoryArguments' => 2,
+        'maximumNumberOfArguments' => 2,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Reflection\ReflectionService->isPropertyTaggedWith' => [
+        'numberOfMandatoryArguments' => 3,
+        'maximumNumberOfArguments' => 3,
+        'restFiles' => [
+            'Deprecation-85004-DeprecateMethodsInReflectionService.rst',
+        ],
+    ],
 ];