Commit 50e3c636 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Georg Ringer
Browse files

[!!!][TASK] Remove support for non namespaced classes in Extbase

Non-namespaced classes will no longer be respected in Extbase.
This affects all places where Extbase magic happens, like translating
the model name to repository name (and vice versa).

If you still use class names with underscores, especially models,
repositories and controllers you need to act now.

Releases: master
Resolves: #85036
Change-Id: Ide5923159027802e723dff49729bba52a74c2639
Reviewed-on: https://review.typo3.org/56990


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 6ddfb9c5
......@@ -34,8 +34,8 @@ class ClassNamingUtility
public static function translateModelNameToRepositoryName($modelName)
{
return str_replace(
['\\Domain\\Model', '_Domain_Model_'],
['\\Domain\\Repository', '_Domain_Repository_'],
'\\Domain\\Model',
'\\Domain\\Repository',
$modelName
) . 'Repository';
}
......@@ -51,8 +51,8 @@ class ClassNamingUtility
public static function translateModelNameToValidatorName($modelName)
{
return str_replace(
['\\Domain\\Model\\', '_Domain_Model_'],
['\\Domain\\Validator\\', '_Domain_Validator_'],
'\\Domain\\Model\\',
'\\Domain\\Validator\\',
$modelName
) . 'Validator';
}
......@@ -68,8 +68,8 @@ class ClassNamingUtility
public static function translateRepositoryNameToModelName($repositoryName)
{
return preg_replace(
['/\\\\Domain\\\\Repository/', '/_Domain_Repository_/', '/Repository$/'],
['\\Domain\\Model', '_Domain_Model_', ''],
['/\\\\Domain\\\\Repository/', '/Repository$/'],
['\\Domain\\Model', ''],
$repositoryName
);
}
......@@ -85,26 +85,18 @@ class ClassNamingUtility
{
$matches = [];
if (strpos($controllerObjectName, '\\') !== false) {
if (substr($controllerObjectName, 0, 9) === 'TYPO3\\CMS') {
$extensionName = '^(?P<vendorName>[^\\\\]+\\\[^\\\\]+)\\\(?P<extensionName>[^\\\\]+)';
} else {
$extensionName = '^(?P<vendorName>[^\\\\]+)\\\\(?P<extensionName>[^\\\\]+)';
}
preg_match(
'/' . $extensionName . '\\\\(Controller|Command|(?P<subpackageKey>.+)\\\\Controller)\\\\(?P<controllerName>[a-z\\\\]+)Controller$/ix',
$controllerObjectName,
$matches
);
if (substr($controllerObjectName, 0, 9) === 'TYPO3\\CMS') {
$extensionName = '^(?P<vendorName>[^\\\\]+\\\[^\\\\]+)\\\(?P<extensionName>[^\\\\]+)';
} else {
preg_match(
'/^Tx_(?P<extensionName>[^_]+)_(Controller|Command|(?P<subpackageKey>.+)_Controller)_(?P<controllerName>[a-z_]+)Controller$/ix',
$controllerObjectName,
$matches
);
$extensionName = '^(?P<vendorName>[^\\\\]+)\\\\(?P<extensionName>[^\\\\]+)';
}
preg_match(
'/' . $extensionName . '\\\\(Controller|Command|(?P<subpackageKey>.+)\\\\Controller)\\\\(?P<controllerName>[a-z\\\\]+)Controller$/ix',
$controllerObjectName,
$matches
);
return array_filter($matches, 'is_string', ARRAY_FILTER_USE_KEY);
}
}
.. include:: ../../Includes.txt
========================================================================
Breaking: #85036 - Removed support for non-namespaced classes in Extbase
========================================================================
See :issue:`85036`
Description
===========
Non-namespaced classes like :php:`Tx_Extension_Controller_FooController` are not supported any more
and all magic based on class names no longer works with classes like these:
* Translating model name to repository name (and vice versa)
* Translating model name to validator name
* Guessing the extension name
* Guessing the controller name by looking at a command name
* Translating model name to (database) table name
* Recognizing child property types in object storage annotations
Impact
======
All this magic no longer works with non-namespaced classes.
Affected Installations
======================
All installations that still use non-namespaced classes in Extbase.
Migration
=========
Use namespaced class names for Extbase.
.. index:: NotScanned, ext:extbase
......@@ -34,41 +34,6 @@ class ClassNamingUtilityTest extends UnitTestCase
public function repositoryAndModelClassNames(): array
{
return [
[
'Tx_BlogExample_Domain_Repository_BlogRepository',
'Tx_BlogExample_Domain_Model_Blog',
'Tx_BlogExample_Domain_Validator_BlogValidator'
],
[
' _Domain_Repository_Content_PageRepository',
' _Domain_Model_Content_Page',
' _Domain_Validator_Content_PageValidator'
],
[
'Tx_RepositoryExample_Domain_Repository_SomeModelRepository',
'Tx_RepositoryExample_Domain_Model_SomeModel',
'Tx_RepositoryExample_Domain_Validator_SomeModelValidator'
],
[
'Tx_RepositoryExample_Domain_Repository_RepositoryRepository',
'Tx_RepositoryExample_Domain_Model_Repository',
'Tx_RepositoryExample_Domain_Validator_RepositoryValidator'
],
[
'Tx_Repository_Domain_Repository_RepositoryRepository',
'Tx_Repository_Domain_Model_Repository',
'Tx_Repository_Domain_Validator_RepositoryValidator'
],
[
'Tx_ModelCollection_Domain_Repository_ModelRepository',
'Tx_ModelCollection_Domain_Model_Model',
'Tx_ModelCollection_Domain_Validator_ModelValidator'
],
[
'Tx_Model_Domain_Repository_ModelRepository',
'Tx_Model_Domain_Model_Model',
'Tx_Model_Domain_Validator_ModelValidator'
],
[
'VENDOR\\EXT\\Domain\\Repository\\BlogRepository',
'VENDOR\\EXT\\Domain\\Model\\Blog',
......@@ -208,31 +173,6 @@ class ClassNamingUtilityTest extends UnitTestCase
'controllerName' => 'Foo',
]
],
// Oldschool
[
'Tx_Ext_Controller_FooController',
[
'extensionName' => 'Ext',
'subpackageKey' => '',
'controllerName' => 'Foo',
]
],
[
'Tx_Ext_Command_FooCommandController',
[
'extensionName' => 'Ext',
'subpackageKey' => '',
'controllerName' => 'FooCommand',
]
],
[
'Tx_Fluid_ViewHelpers_Widget_Controller_PaginateController',
[
'extensionName' => 'Fluid',
'subpackageKey' => 'ViewHelpers_Widget',
'controllerName' => 'Paginate',
]
],
];
}
......
......@@ -64,6 +64,9 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
public function initialize($configuration)
{
if (!$this->isInCliMode()) {
if (!isset($configuration['vendorName']) || $configuration['vendorName'] === '') {
throw new \RuntimeException('Invalid configuration: "vendorName" is not set', 1526629315);
}
if (!isset($configuration['extensionName']) || $configuration['extensionName'] === '') {
throw new \RuntimeException('Invalid configuration: "extensionName" is not set', 1290623020);
}
......
......@@ -93,8 +93,7 @@ class Command
$this->controllerClassName = $controllerClassName;
$this->controllerCommandName = $controllerCommandName;
$this->controllerCommandMethod = $this->controllerCommandName . 'Command';
$delimiter = strpos($controllerClassName, '\\') !== false ? '\\' : '_';
$classNameParts = explode($delimiter, $controllerClassName);
$classNameParts = explode('\\', $controllerClassName);
if (isset($classNameParts[0]) && $classNameParts[0] === 'TYPO3' && isset($classNameParts[1]) && $classNameParts[1] === 'CMS') {
$classNameParts[0] .= '\\' . $classNameParts[1];
unset($classNameParts[1]);
......
......@@ -131,16 +131,12 @@ abstract class AbstractController implements ControllerInterface
public function __construct()
{
$className = static::class;
if (strpos($className, '\\') !== false) {
$classNameParts = explode('\\', $className, 4);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$this->extensionName = $classNameParts[2];
} else {
$this->extensionName = $classNameParts[1];
}
$classNameParts = explode('\\', $className, 4);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$this->extensionName = $classNameParts[2];
} else {
list(, $this->extensionName) = explode('_', $className);
$this->extensionName = $classNameParts[1];
}
}
......
......@@ -25,13 +25,6 @@ class Request implements RequestInterface
{
const PATTERN_MATCH_FORMAT = '/^[a-z0-9]{1,5}$/';
/**
* Pattern after which the controller object name is built
*
* @var string
*/
protected $controllerObjectNamePattern = 'Tx_@extension_@subpackage_Controller_@controllerController';
/**
* Pattern after which the namespaced controller object name is built
*
......@@ -146,42 +139,24 @@ class Request implements RequestInterface
*/
public function getControllerObjectName()
{
if (null !== $this->controllerVendorName) {
// It's safe to assume a namespaced name as namespaced names have to follow PSR-0
$objectName = str_replace(
[
'@extension',
'@subpackage',
'@controller',
'@vendor',
'\\\\'
],
[
$this->controllerExtensionName,
$this->controllerSubpackageKey,
$this->controllerName,
$this->controllerVendorName,
'\\'
],
$this->namespacedControllerObjectNamePattern
);
} else {
$objectName = str_replace(
[
'@extension',
'@subpackage',
'@controller',
'__'
],
[
$this->controllerExtensionName,
$this->controllerSubpackageKey,
$this->controllerName,
'_'
],
$this->controllerObjectNamePattern
);
}
$objectName = str_replace(
[
'@extension',
'@subpackage',
'@controller',
'@vendor',
'\\\\'
],
[
$this->controllerExtensionName,
$this->controllerSubpackageKey,
$this->controllerName,
$this->controllerVendorName,
'\\'
],
$this->namespacedControllerObjectNamePattern
);
// @todo implement getCaseSensitiveObjectName()
if ($objectName === false) {
throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchControllerException('The controller object "' . $objectName . '" does not exist.', 1220884009);
......@@ -296,9 +271,6 @@ class Request implements RequestInterface
if (!is_string($controllerName) && $controllerName !== null) {
throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException('The controller name must be a valid string, ' . gettype($controllerName) . ' given.', 1187176358);
}
if (strpos($controllerName, '_') !== false) {
throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException('The controller name must not contain underscores.', 1217846412);
}
if ($controllerName !== null) {
$this->controllerName = $controllerName;
}
......
......@@ -185,18 +185,15 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface
protected function resolveTableName($className)
{
$className = ltrim($className, '\\');
if (strpos($className, '\\') !== false) {
$classNameParts = explode('\\', $className);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$classPartsToSkip = 2;
} else {
$classPartsToSkip = 1;
}
$tableName = 'tx_' . strtolower(implode('_', array_slice($classNameParts, $classPartsToSkip)));
$classNameParts = explode('\\', $className);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$classPartsToSkip = 2;
} else {
$tableName = strtolower($className);
$classPartsToSkip = 1;
}
$tableName = 'tx_' . strtolower(implode('_', array_slice($classNameParts, $classPartsToSkip)));
return $tableName;
}
......
......@@ -21,8 +21,6 @@ namespace TYPO3\CMS\Extbase\Property;
* The TYPO3 project - inspiring people to share! *
* */
use TYPO3\CMS\Core\Core\ClassLoadingInformation;
/**
* Concrete configuration object for the PropertyMapper.
*
......@@ -303,9 +301,6 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf
*/
public function setTypeConverterOptions($typeConverter, array $options)
{
if (strpos($typeConverter, '_') !== false) {
$typeConverter = ClassLoadingInformation::getClassNameForAlias($typeConverter);
}
foreach ($this->getTypeConvertersWithParentClasses($typeConverter) as $typeConverter) {
$this->configuration[$typeConverter] = $options;
}
......@@ -323,9 +318,6 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf
*/
public function setTypeConverterOption($typeConverter, $optionKey, $optionValue)
{
if (strpos($typeConverter, '_') !== false) {
$typeConverter = ClassLoadingInformation::getClassNameForAlias($typeConverter);
}
foreach ($this->getTypeConvertersWithParentClasses($typeConverter) as $typeConverter) {
$this->configuration[$typeConverter][$optionKey] = $optionValue;
}
......
......@@ -138,22 +138,16 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
continue;
}
$className = $command->getControllerClassName();
if (strpos($className, '\\')) {
$classNameParts = explode('\\', $className);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$classPartsToSkip = 2;
} else {
$classPartsToSkip = 1;
}
$classNameParts = array_slice($classNameParts, $classPartsToSkip);
$extensionName = $classNameParts[0];
$controllerName = $classNameParts[2];
$classNameParts = explode('\\', $className);
// Skip vendor and product name for core classes
if (strpos($className, 'TYPO3\\CMS\\') === 0) {
$classPartsToSkip = 2;
} else {
$classNameParts = explode('_', $className);
$extensionName = $classNameParts[1];
$controllerName = $classNameParts[3];
$classPartsToSkip = 1;
}
$classNameParts = array_slice($classNameParts, $classPartsToSkip);
$extensionName = $classNameParts[0];
$controllerName = $classNameParts[2];
$identifier = $command->getCommandIdentifier();
$options[$identifier] = $extensionName . ' ' . str_replace('CommandController', '', $controllerName) . ': ' . $command->getControllerCommandName();
}
......
......@@ -19,7 +19,7 @@ class TypeHandlingUtility
/**
* A property type parse pattern.
*/
const PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTime|Tx_[a-zA-Z0-9_]+|[A-Z][a-zA-Z0-9\\\\_]+|object|resource|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\_]+)>)?/';
const PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTime|[A-Z][a-zA-Z0-9\\\\]+|object|resource|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\]+)>)?/';
/**
* A type pattern to detect literal types.
......
......@@ -28,14 +28,13 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
{
/**
* Match validator names and options
* @todo: adjust [a-z0-9_:.\\\\] once Tx_Extbase_Foo syntax is outdated.
* @deprecated and will be removed in TYPO3 v10.0.
*
* @var string
*/
const PATTERN_MATCH_VALIDATORS = '/
(?:^|,\s*)
(?P<validatorName>[a-z0-9_:.\\\\]+)
(?P<validatorName>[a-z0-9:.\\\\]+)
\s*
(?:\(
(?P<validatorOptions>(?:\s*[a-z0-9]+\s*=\s*(?:
......@@ -182,8 +181,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
throw new Exception\InvalidTypeHintException('Missing type information, probably no @param annotation for parameter "$' . $parameterName . '" in ' . $className . '->' . $methodName . '()', 1281962564);
}
// @todo: remove check for old underscore model name syntax once it's possible
if (strpbrk($methodParameter['type'], '_\\') === false) {
if (strpbrk($methodParameter['type'], '\\') === false) {
$typeValidator = $this->createValidator($methodParameter['type']);
} else {
$typeValidator = null;
......@@ -478,19 +476,17 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
$extensionName = array_pop($extensionNameParts);
$vendorName = implode('\\', $extensionNameParts);
$possibleClassName = $vendorName . '\\' . $extensionName . '\\Validation\\Validator\\' . $extensionValidatorName;
} else {
$possibleClassName = 'Tx_' . $extensionName . '_Validation_Validator_' . $extensionValidatorName;
}
} else {
// Shorthand built in
$possibleClassName = 'TYPO3\\CMS\\Extbase\\Validation\\Validator\\' . $this->getValidatorType($validatorName);
}
} elseif (strpbrk($validatorName, '_\\') === false) {
} elseif (strpbrk($validatorName, '\\') === false) {
// Shorthand built in
$possibleClassName = 'TYPO3\\CMS\\Extbase\\Validation\\Validator\\' . $this->getValidatorType($validatorName);
} else {
// Full qualified
// Tx_MyExt_Validation_Validator_MyValidator or \Acme\Ext\Validation\Validator\FooValidator
// Example: \Acme\Ext\Validation\Validator\FooValidator
$possibleClassName = $validatorName;
if (!empty($possibleClassName) && $possibleClassName[0] === '\\') {
$possibleClassName = substr($possibleClassName, 1);
......
......@@ -55,9 +55,10 @@ class CommandTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
public function commandIdentifiers()
{
return [
['Tx_ExtensionKey_Command_CacheCommandController', 'flush', 'extension_key:cache:flush'],
['Tx_Ext_Command_CookieCommandController', 'bake', 'ext:cookie:bake'],
['Tx_OtherExtensionKey_Foo_Faa_Fuuum_Command_CoffeeCommandController', 'brew', 'other_extension_key:coffee:brew'],
['Tx\ExtensionKey\Command\CacheCommandController', 'flush', 'extension_key:cache:flush'],
['Tx\Ext\Command\CookieCommandController', 'bake', 'ext:cookie:bake'],
['Tx\OtherExtensionKey\Foo\Faa\Fuuum\Command\CoffeeCommandController', 'brew', 'other_extension_key:coffee:brew'],
];
}
......
......@@ -71,7 +71,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$this->mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
$this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class)->will($this->returnValue($this->request));
$this->mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
$this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Tx_SomeExtensionName_Command_DefaultCommandController'));
$this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Tx\\SomeExtensionName\\Command\\DefaultCommandController'));
$this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
$this->mockCommandManager = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
$this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('some_extension_name:default:list')->will($this->returnValue($this->mockCommand));
......@@ -93,7 +93,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
{
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->will($this->returnValue([]));
$request = $this->requestBuilder->build('some_extension_name:default:list');
$this->assertSame('Tx_SomeExtensionName_Command_DefaultCommandController', $request->getControllerObjectName());
$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.');
}
......@@ -128,7 +128,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$methodParameters = [
'testArgument' => ['optional' => false, 'type' => 'string']
];
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx_SomeExtensionName_Command_DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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.');
......@@ -145,7 +145,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
'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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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.');
......@@ -166,7 +166,7 @@ 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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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.');
......@@ -190,7 +190,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
'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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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.');
......@@ -224,7 +224,7 @@ 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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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.');
......@@ -260,7 +260,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
'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));
$this->mockReflectionService->expects($this->exactly(2))->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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'));
......@@ -280,7 +280,7 @@ 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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$request = $this->requestBuilder->build('some_extension_name:default:list --some -option=value file1 file2');
$this->assertSame('list', $request->getControllerCommandName());
$this->assertTrue($request->getArgument('some'));
......@@ -297,7 +297,7 @@ 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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$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());
......@@ -315,7 +315,7 @@ 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));
$this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx\\SomeExtensionName\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
$this->requestBuilder->build('some_extension_name:default:list --test-argument1 firstArgumentValue secondArgumentValue');
}
......@@ -330,7 +330,7 @@ class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
'requiredArgument1' => ['optional' => false, 'type' => 'string'],
'requiredArgument2' => ['optional' => false, 'type' => 'string']