[TASK] Deprecate Extbase CommandControllers and @cli annotation 64/58064/7
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sat, 25 Aug 2018 12:27:25 +0000 (14:27 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 31 Aug 2018 09:15:02 +0000 (11:15 +0200)
Back then, the PHPDoc annotation `@cli` was added to indicate
Extbase CommandController commands to be usable on CLI only
instead of also be usable as a scheduler task.

The concept of Extbase Command Controllers has been superseded
with symfony/console and its integration into TYPO3 CLI in TYPO3 v8.0,
and contains all features necessary to build commands of any kind
of complexity.

As a matter of documentation, it is however crucial to document
how to instantiate Extbase from CLI to migrate easily from Extbase CLI
to symfony/console.

Releases: master
Resolves: #85977
Change-Id: Id87c2ce300e01bf649bd1c2219aa17b8437bda83
Reviewed-on: https://review.typo3.org/58064
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
46 files changed:
Build/Scripts/annotationChecker.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst [new file with mode: 0644]
typo3/sysext/extbase/Classes/Command/CoreCommand.php
typo3/sysext/extbase/Classes/Command/ExtbaseCommand.php
typo3/sysext/extbase/Classes/Command/HelpCommand.php
typo3/sysext/extbase/Classes/Command/HelpCommandController.php
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php
typo3/sysext/extbase/Classes/Mvc/Cli/CommandArgumentDefinition.php
typo3/sysext/extbase/Classes/Mvc/Cli/CommandManager.php
typo3/sysext/extbase/Classes/Mvc/Cli/ConsoleOutput.php
typo3/sysext/extbase/Classes/Mvc/Cli/Request.php
typo3/sysext/extbase/Classes/Mvc/Cli/RequestBuilder.php
typo3/sysext/extbase/Classes/Mvc/Cli/RequestHandler.php
typo3/sysext/extbase/Classes/Mvc/Cli/Response.php
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
typo3/sysext/extbase/Classes/Mvc/Controller/CommandControllerInterface.php
typo3/sysext/extbase/Classes/Mvc/Exception/AmbiguousCommandIdentifierException.php
typo3/sysext/extbase/Classes/Mvc/Exception/CommandException.php
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php
typo3/sysext/extbase/Classes/Scheduler/Task.php
typo3/sysext/extbase/Classes/Scheduler/TaskExecutor.php
typo3/sysext/extbase/Configuration/Commands.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockACommandController.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockBCommandController.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockCCommandController.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php [deleted file]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandManagerTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockACommandController.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockBCommandController.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockCCommandController.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestBuilderTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Controller/CommandControllerTest.php [new file with mode: 0644]
typo3/sysext/extbase/ext_localconf.php
typo3/sysext/extbase/ext_typoscript_setup.typoscript
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodAnnotationMatcher.php
typo3/sysext/scheduler/Classes/Task/ExecuteSchedulableCommandAdditionalFieldProvider.php
typo3/sysext/scheduler/Classes/Task/ExecuteSchedulableCommandTask.php

index 4e89a94..cc664eb 100755 (executable)
@@ -62,8 +62,10 @@ class NodeVisitor extends NodeVisitorAbstract
                     'env',
                     // PHPCheckStyle
                     'SuppressWarnings', 'noinspection',
-                    // Extbase related (deprecated)
-                    'transient', 'cli', 'flushesCaches',
+                    // Extbase related (deprecated), will be removed in TYPO3 v10.0
+                    'transient',
+                    'cli', // this is still used in Extbase\Tests\UnitDeprecated
+                    'flushesCaches',
                     // Extbase related
                     'TYPO3\\\\CMS\\\\Extbase\\\\Annotation\\\\Inject', 'Extbase\\\\Inject', 'Inject',
                     'TYPO3\\\\CMS\\\\Extbase\\\\Annotation\\\\Validate', 'Extbase\\\\Validate', 'Validate',
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst
new file mode 100644 (file)
index 0000000..0c8111c
--- /dev/null
@@ -0,0 +1,56 @@
+.. include:: ../../Includes.txt
+
+========================================================================================
+Deprecation: #85977 - Extbase CLI functionality, Command Controllers and @cli Annotation
+========================================================================================
+
+See :issue:`85977`
+
+Description
+===========
+
+TYPO3 supports Symfony Console commands natively since TYPO3 8.0. Since version 9.0 it is possible to also register
+Symfony Console commands within scheduler, just like Extbase CommandControllers can be handled.
+
+The main advantage of Symfony Console commands over Extbase Command Controllers is that they run very early in a
+CLI context, not needing a database connection or other restrictions. On top comes better alias handling, CLI argument
+and option handling.
+
+As a trade-off, Extbase's ObjectManager and Configuration Handling and ORM is not available by default.
+
+Since TYPO3 9.4, it is possible to also register a Symfony Console command as "schedulable", to control the visibility
+of a certain Symfony Command in Scheduler, making the PHPDoc annotation `@cli` obsolete.
+
+Impact
+======
+
+Using a CommandController via CLI will trigger a deprecation warning. All other PHP classes for Extbase's CLI
+functionality have been marked as deprecated, but will not trigger a deprecation warning.
+
+Using @cli will also log a deprecation warning. Once removed from your commands, they will appear in the list of
+executable executable commands in the scheduler module.
+
+
+Affected Installations
+======================
+
+All installations that make use of command controllers or methods tagged with `@cli`.
+
+
+Migration
+=========
+
+Migrate custom commands within CommandControllers as symfony commands as TYPO3 Core does. Use specific argument
+definitions on what parameters will be available.
+
+See documentation https://symfony.com/doc/current/console.html and
+https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/BackendModules/CliScripts/Index.html for detailed
+descriptions on how to write Console Commands and how to integrate them into TYPO3.
+
+Think twice if you need all of Extbase's power of Dependency Injection (ObjectManager / ObjectContainer) and Domain
+Model / Repositories and ORM, or if native database queries will suit your task better.
+
+If anything related to DataHandler and Backend permission handling is necessary, you should run
+:php:`Bootstrap::initializeBackendAuthentication();`.
+
+.. index:: FullyScanned, ext:scheduler
index 15f1bff..a578da7 100644 (file)
@@ -25,6 +25,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
  * Main call to register any Extbase command from Extbase command controllers
  *
  * Fetches all registered Extbase commands and adds them to the application as custom Extbase commands
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class CoreCommand extends Command
 {
index 2f5e68e..9c6aa29 100644 (file)
@@ -23,6 +23,7 @@ use TYPO3\CMS\Extbase\Core\Bootstrap;
 
 /**
  * Wrapper to wrap an Extbase command from a command controller into a Symfony Command
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class ExtbaseCommand extends Command
 {
index 17e98b5..b8a50ff 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Extbase\Core\Bootstrap;
 
 /**
  * Extends the help command of symfony to show the specific help for Extbase commands
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class HelpCommand extends \Symfony\Component\Console\Command\HelpCommand
 {
index cf0216b..9862b20 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Command;
  * A Command Controller which provides help for available commands
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0.
  */
 class HelpCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController
 {
@@ -63,7 +64,6 @@ class HelpCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandCon
      * ./typo3/sysext/core/bin/typo3 extbase:help <command identifier>
      *
      * @param string $commandIdentifier Identifier of a command for more details
-     * @cli
      */
     public function helpCommand($commandIdentifier = null)
     {
index 974d69d..a24099c 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Extbase\Reflection\ClassSchema;
  * Represents a Command
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class Command
 {
index 4903dce..1f407c5 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Cli;
  * Represents a CommandArgumentDefinition
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class CommandArgumentDefinition
 {
index 4ef7541..e19eb43 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Cli;
  * A helper for CLI commands
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class CommandManager implements \TYPO3\CMS\Core\SingletonInterface
 {
index 1fe5a0d..8380fe1 100644 (file)
@@ -28,6 +28,7 @@ use Symfony\Component\Console\Question\Question;
 
 /**
  * A wrapper for Symfony ConsoleOutput and related helpers
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class ConsoleOutput
 {
index 79801d5..823d9c2 100644 (file)
@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Cli;
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  * @api
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface
 {
index 7886f10..853ee28 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Cli;
  * Builds a CLI request object from the raw command call
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
 {
index ac26861..604f998 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Core\Environment;
  * The generic command line interface request handler for the MVC framework.
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class RequestHandler implements \TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface
 {
index 1254b1f..f7f94bb 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Cli;
  * A CLI specific response implementation
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class Response extends \TYPO3\CMS\Extbase\Mvc\Response
 {
index 33b91d0..f88a4ae 100644 (file)
@@ -32,6 +32,7 @@ use TYPO3\CMS\Extbase\Reflection\ReflectionService;
  * A controller which processes requests from the command line
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class CommandController implements CommandControllerInterface
 {
@@ -80,6 +81,11 @@ class CommandController implements CommandControllerInterface
      */
     protected $output;
 
+    public function __construct()
+    {
+        trigger_error('Extbase Command Controllers will be removed in TYPO3 v10.0. Migrate to symfony/console commands instead.', E_USER_DEPRECATED);
+    }
+
     /**
      * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
      */
index 96ef57c..b4a60bb 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Controller;
  * Interface for command controllers
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 interface CommandControllerInterface extends \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface
 {
index faf24d8..438fdf4 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Exception;
  * An "Ambiguous command identifier" exception
  *
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class AmbiguousCommandIdentifierException extends \TYPO3\CMS\Extbase\Mvc\Exception\CommandException
 {
index 74d26b4..8470217 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Exception;
 
 /**
  * Base command exception
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class CommandException extends \TYPO3\CMS\Extbase\Mvc\Exception
 {
index 48bd7a3..f5b16e5 100644 (file)
@@ -414,6 +414,16 @@ class ClassSchema
             }
 
             foreach ($docCommentParser->getTagsValues() as $tag => $values) {
+                if ($tag === 'cli') {
+                    trigger_error(
+                        sprintf(
+                            'Method %s::%s is tagged with @cli which is deprecated and will be removed in TYPO3 v10.0.',
+                            $reflectionClass->getName(),
+                            $reflectionMethod->getName()
+                        ),
+                        E_USER_DEPRECATED
+                    );
+                }
                 if ($tag === 'ignorevalidation') {
                     trigger_error(
                         sprintf(
index 407668f..e20963b 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Scheduler\Task\AbstractTask;
 
 /**
  * Field provider for Extbase CommandController Scheduler task
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class FieldProvider implements AdditionalFieldProviderInterface
 {
index 384a289..3461fe6 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Scheduler\Task\AbstractTask;
 
 /**
  * Scheduler task to execute CommandController commands
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class Task extends AbstractTask
 {
index 85d38be..90f2416 100644 (file)
@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Extbase\Scheduler;
  *
  * Takes a \TYPO3\CMS\Extbase\Scheduler\Task and executes the CommandController command
  * defined therein.
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 class TaskExecutor implements \TYPO3\CMS\Core\SingletonInterface
 {
index 93007af..a11aeda 100644 (file)
@@ -4,6 +4,7 @@
  * is the name of the command (to be called as the first argument after typo3).
  * Required parameter is the "class" of the command which needs to be a subclass
  * of Symfony/Console/Command.
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
  */
 return [
     '_core_command' => [
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php
deleted file mode 100644 (file)
index beafc4f..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                            *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-use TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException;
-use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException;
-
-/**
- * Test case
- */
-class CommandManagerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-     */
-    protected $mockObjectManager;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
-     */
-    protected $commandManager;
-
-    protected function setUp()
-    {
-        $this->commandManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class, ['getAvailableCommands']);
-        $this->mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
-        $this->commandManager->_set('objectManager', $this->mockObjectManager);
-    }
-
-    /**
-     * @test
-     */
-    public function getAvailableCommandsReturnsAllAvailableCommands()
-    {
-        /** @var \TYPO3\TestingFramework\Core\AccessibleObjectInterface $commandManager */
-        $commandManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class, ['dummy']);
-        $commandManager->_set('objectManager', $this->mockObjectManager);
-        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'] = [
-            \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class,
-            \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockBCommandController::class
-        ];
-        $mockCommand1 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand2 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand3 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $this->mockObjectManager->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class, 'foo')->will($this->returnValue($mockCommand1));
-        $this->mockObjectManager->expects($this->at(1))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockACommandController::class, 'bar')->will($this->returnValue($mockCommand2));
-        $this->mockObjectManager->expects($this->at(2))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockBCommandController::class, 'baz')->will($this->returnValue($mockCommand3));
-        $commands = $commandManager->getAvailableCommands();
-        $this->assertEquals(3, count($commands));
-        $this->assertSame($mockCommand1, $commands[0]);
-        $this->assertSame($mockCommand2, $commands[1]);
-        $this->assertSame($mockCommand3, $commands[2]);
-    }
-
-    /**
-     * @test
-     */
-    public function getCommandByIdentifierReturnsCommandIfIdentifierIsEqual()
-    {
-        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
-        $mockCommands = [$mockCommand];
-        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
-        $this->assertSame($mockCommand, $this->commandManager->getCommandByIdentifier('extensionkey:controller:command'));
-    }
-
-    /**
-     * @test
-     */
-    public function getCommandByIdentifierWorksCaseInsensitive()
-    {
-        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
-        $mockCommands = [$mockCommand];
-        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
-        $this->assertSame($mockCommand, $this->commandManager->getCommandByIdentifier('   ExtensionKey:conTroLler:Command  '));
-    }
-
-    /**
-     * @test
-     */
-    public function getCommandByIdentifierThrowsExceptionIfNoMatchingCommandWasFound()
-    {
-        $this->expectException(NoSuchCommandException::class);
-        $this->expectExceptionCode(1310556663);
-        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
-        $mockCommands = [$mockCommand];
-        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
-        $this->commandManager->getCommandByIdentifier('extensionkey:controller:someothercommand');
-    }
-
-    /**
-     * @test
-     */
-    public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingCommandWasFound()
-    {
-        $this->expectException(AmbiguousCommandIdentifierException::class);
-        $this->expectExceptionCode(1310557169);
-        $mockCommand1 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
-        $mockCommand2 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
-        $mockCommand2->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('otherextensionkey:controller:command'));
-        $mockCommands = [$mockCommand1, $mockCommand2];
-        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
-        $this->commandManager->getCommandByIdentifier('controller:command');
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php
deleted file mode 100644 (file)
index a3536f3..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                            *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Mvc\Cli\Command;
-use TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
-use TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command\MockCCommandController;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Test case
- */
-class CommandTest extends UnitTestCase
-{
-    /**
-     * @var bool Reset singletons created by subject
-     */
-    protected $resetSingletonInstances = true;
-
-    /**
-     * @return array
-     */
-    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'],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider commandIdentifiers
-     * @param string $controllerClassName
-     * @param string $commandName
-     * @param string $expectedCommandIdentifier
-     */
-    public function constructRendersACommandIdentifierByTheGivenControllerAndCommandName($controllerClassName, $commandName, $expectedCommandIdentifier)
-    {
-        $command = new \TYPO3\CMS\Extbase\Mvc\Cli\Command($controllerClassName, $commandName);
-        $this->assertEquals($expectedCommandIdentifier, $command->getCommandIdentifier());
-    }
-
-    /**
-     * @return array
-     */
-    public function invalidCommandClassNames()
-    {
-        return [
-            [''],
-            // CommandClassName must not be empty
-            ['Foo']
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider invalidCommandClassNames
-     * @param string $controllerClassName
-     */
-    public function constructThrowsExceptionIfCommandClassNameIsInvalid($controllerClassName)
-    {
-        $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionCode(1438782187);
-        new \TYPO3\CMS\Extbase\Mvc\Cli\Command($controllerClassName, 'foo');
-    }
-
-    public function testIsInternal()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertFalse($commandController->isInternal());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'internal'
-        );
-
-        static::assertTrue($commandController->isInternal());
-    }
-
-    public function testIsCliOnly()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertFalse($commandController->isCliOnly());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'cliOnly'
-        );
-
-        static::assertTrue($commandController->isCliOnly());
-    }
-
-    public function testIsFlushinCaches()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertFalse($commandController->isFlushingCaches());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'flushingCaches'
-        );
-
-        static::assertTrue($commandController->isFlushingCaches());
-    }
-
-    public function testHasArguments()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertFalse($commandController->hasArguments());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'withArguments'
-        );
-
-        static::assertTrue($commandController->hasArguments());
-    }
-
-    public function testGetArgumentDefinitions()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertSame([], $commandController->getArgumentDefinitions());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'withArguments'
-        );
-
-        $expected = [
-            new CommandArgumentDefinition('foo', true, 'FooParamDescription'),
-            new CommandArgumentDefinition('bar', false, 'BarParamDescription'),
-        ];
-
-        static::assertEquals($expected, $commandController->getArgumentDefinitions());
-    }
-
-    public function testGetDescription()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertSame('', $commandController->getDescription());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'withDescription'
-        );
-
-        $expected = 'Longer Description' . LF .
-            'Multine' . LF . LF .
-            'Much Multiline';
-
-        static::assertEquals($expected, $commandController->getDescription());
-    }
-
-    public function testGetShortDescription()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertSame('', $commandController->getShortDescription());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'withDescription'
-        );
-
-        $expected = 'Short Description';
-
-        static::assertEquals($expected, $commandController->getShortDescription());
-    }
-
-    public function testGetRelatedCommandIdentifiers()
-    {
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'empty'
-        );
-
-        static::assertSame([], $commandController->getRelatedCommandIdentifiers());
-
-        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
-            Command::class,
-            MockCCommandController::class,
-            'relatedCommandIdentifiers'
-        );
-
-        $expected = ['Foo:Bar:Baz'];
-        static::assertEquals($expected, $commandController->getRelatedCommandIdentifiers());
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockACommandController.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockACommandController.php
deleted file mode 100644 (file)
index 72084c1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                            *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-/**
- * A mock CLI Command
- */
-class MockACommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
-{
-    public function fooCommand()
-    {
-    }
-
-    /**
-     * @param mixed $someArgument
-     */
-    public function barCommand($someArgument)
-    {
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockBCommandController.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockBCommandController.php
deleted file mode 100644 (file)
index 2dc2145..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command;
-
-/**
- * Another mock CLI Command
- */
-class MockBCommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
-{
-    public function bazCommand()
-    {
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockCCommandController.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/Fixture/Command/MockCCommandController.php
deleted file mode 100644 (file)
index 463c0b4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli\Fixture\Command;
-
-/**
- * Another mock CLI Command
- */
-class MockCCommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
-{
-    public function emptyCommand()
-    {
-    }
-
-    /**
-     * @internal
-     */
-    public function internalCommand()
-    {
-    }
-
-    /**
-     * @cli
-     */
-    public function cliOnlyCommand()
-    {
-    }
-
-    /**
-     * @flushesCaches
-     */
-    public function flushingCachesCommand()
-    {
-    }
-
-    /**
-     * @param string $foo FooParamDescription
-     * @param string $bar BarParamDescription
-     */
-    public function withArgumentsCommand($foo, $bar = 'baz')
-    {
-    }
-
-    /**
-     * Short Description
-     *
-     * Longer Description
-     * Multine
-     *
-     * Much Multiline
-     */
-    public function withDescriptionCommand()
-    {
-    }
-
-    /**
-     * @see Foo:Bar:Baz
-     */
-    public function relatedCommandIdentifiersCommand()
-    {
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php
deleted file mode 100644 (file)
index 32c9c8d..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                            *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException;
-use TYPO3\CMS\Extbase\Reflection\ClassSchema;
-
-/**
- * Test case
- */
-class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit_Framework_Comparator_MockObject
-     */
-    protected $requestBuilder;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\Request|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
-     */
-    protected $request;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-     */
-    protected $mockObjectManager;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command
-     */
-    protected $mockCommand;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
-     */
-    protected $mockCommandManager;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService|\PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $mockReflectionService;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface|\PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $mockConfigurationManager;
-
-    /**
-     * Sets up this test case
-     */
-    protected function setUp()
-    {
-        $this->request = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class, ['dummy']);
-        $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('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));
-        $this->mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-        $this->mockConfigurationManager = $this->createMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
-        $this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::class, ['dummy']);
-        $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
-        $this->requestBuilder->_set('reflectionService', $this->mockReflectionService);
-        $this->requestBuilder->_set('commandManager', $this->mockCommandManager);
-        $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
-    }
-
-    /**
-     * Checks if a CLI request specifying a package, controller and action name results in the expected request object
-     *
-     * @test
-     */
-    public function cliAccessWithExtensionControllerAndActionNameBuildsCorrectRequest(): void
-    {
-        $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.');
-    }
-
-    /**
-     * @test
-     */
-    public function ifCommandCantBeResolvedTheHelpScreenIsShown()
-    {
-        // The following call is only made to satisfy PHPUnit. For some weird reason PHPUnit complains that the
-        // mocked method ("getObjectNameByClassName") does not exist _if the mock object is not used_.
-        $this->mockCommandManager->getCommandByIdentifier('some_extension_name:default:list');
-        $mockCommandManager = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
-        $mockCommandManager
-            ->expects($this->any())
-            ->method('getCommandByIdentifier')
-            ->with('test:default:list')
-            ->will(
-                $this->throwException(
-                new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException('testing', 1476050312)
-            )
-            );
-        $this->requestBuilder->_set('commandManager', $mockCommandManager);
-        $request = $this->requestBuilder->build('test:default:list');
-        $this->assertSame(\TYPO3\CMS\Extbase\Command\HelpCommandController::class, $request->getControllerObjectName());
-    }
-
-    /**
-     * @test
-     */
-    public function argumentWithValueSeparatedByEqualSignBuildsCorrectRequest(): void
-    {
-        $methodParameters = [
-            'testArgument' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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.');
-    }
-
-    /**
-     * Checks if a CLI request specifying some "console style" (--my-argument=value) arguments results in the expected request object
-     *
-     * @test
-     */
-    public function cliAccessWithExtensionControllerActionAndArgumentsBuildsCorrectRequest(): void
-    {
-        $methodParameters = [
-            'testArgument' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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.');
-        $this->assertEquals($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
-        $this->assertEquals($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
-    }
-
-    /**
-     * Checks if a CLI request specifying some "console style" (--my-argument =value) arguments with spaces between name and value results in the expected request object
-     *
-     * @test
-     */
-    public function checkIfCLIAccesWithPackageControllerActionAndArgumentsToleratesSpaces(): void
-    {
-        $methodParameters = [
-            'testArgument' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string'],
-            'testArgument3' => ['optional' => false, 'type' => 'string'],
-            'testArgument4' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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.');
-        $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
-        $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
-    }
-
-    /**
-     * Checks if a CLI request specifying some short "console style" (-c value or -c=value or -c = value) arguments results in the expected request object
-     *
-     * @test
-     */
-    public function CLIAccesWithShortArgumentsBuildsCorrectRequest(): void
-    {
-        $methodParameters = [
-            'a' => ['optional' => false, 'type' => 'string'],
-            'd' => ['optional' => false, 'type' => 'string'],
-            'f' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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.');
-        $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
-        $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
-        $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
-        $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
-    }
-
-    /**
-     * Checks if a CLI request specifying some mixed "console style" (-c or --my-argument -f=value) arguments with and
-     * without values results in the expected request object
-     *
-     * @test
-     */
-    public function CLIAccesWithArgumentsWithAndWithoutValuesBuildsCorrectRequest(): void
-    {
-        $methodParameters = [
-            'testArgument' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string'],
-            'testArgument3' => ['optional' => false, 'type' => 'string'],
-            'testArgument4' => ['optional' => false, 'type' => 'string'],
-            'testArgument5' => ['optional' => false, 'type' => 'string'],
-            'testArgument6' => ['optional' => false, 'type' => 'string'],
-            'testArgument7' => ['optional' => false, 'type' => 'string'],
-            'f' => ['optional' => false, 'type' => 'string'],
-            'd' => ['optional' => false, 'type' => 'string'],
-            'a' => ['optional' => false, 'type' => 'string'],
-            'c' => ['optional' => false, 'type' => 'string'],
-            'j' => ['optional' => false, 'type' => 'string'],
-            'k' => ['optional' => false, 'type' => 'string'],
-            'm' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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.');
-        $this->assertTrue($request->hasArgument('k'), 'The given "k" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('f'), 'The given "f" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('d'), 'The given "d" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('c'), 'The given "d" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument7'), 'The given "testArgument7" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument5'), 'The given "testArgument5" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('testArgument6'), 'The given "testArgument6" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('j'), 'The given "j" was not found in the built request.');
-        $this->assertTrue($request->hasArgument('m'), 'The given "m" was not found in the built request.');
-        $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
-        $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
-        $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
-        $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
-        $this->assertSame($request->getArgument('testArgument5'), '5', 'The "testArgument4" had not the given value.');
-        $this->assertSame($request->getArgument('j'), 'kjk', 'The "j" had not the given value.');
-    }
-
-    /**
-     * @test
-     */
-    public function insteadOfNamedArgumentsTheArgumentsCanBePassedUnnamedInTheCorrectOrder(): void
-    {
-        $methodParameters = [
-            'testArgument1' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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'));
-        $request = $this->requestBuilder->build('some_extension_name:default:list firstArgumentValue secondArgumentValue');
-        $this->assertSame('firstArgumentValue', $request->getArgument('testArgument1'));
-        $this->assertSame('secondArgumentValue', $request->getArgument('testArgument2'));
-    }
-
-    /**
-     * @test
-     */
-    public function argumentsAreDetectedAfterOptions(): void
-    {
-        $methodParameters = [
-            'some' => ['optional' => true, 'type' => 'boolean'],
-            'option' => ['optional' => true, 'type' => 'string'],
-            'argument1' => ['optional' => false, 'type' => 'string'],
-            'argument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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'));
-        $this->assertSame('file1', $request->getArgument('argument1'));
-        $this->assertSame('file2', $request->getArgument('argument2'));
-    }
-
-    /**
-     * @test
-     */
-    public function exceedingArgumentsMayBeSpecified(): void
-    {
-        $methodParameters = [
-            'testArgument1' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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());
-        $this->assertEquals(['exceedingArgument1'], $request->getExceedingArguments());
-    }
-
-    /**
-     * @test
-     */
-    public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed(): void
-    {
-        $this->expectException(InvalidArgumentMixingException::class);
-        $this->expectExceptionCode(1309971820);
-        $methodParameters = [
-            'testArgument1' => ['optional' => false, 'type' => 'string'],
-            'testArgument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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(): void
-    {
-        $this->expectException(InvalidArgumentMixingException::class);
-        $this->expectExceptionCode(1309971821);
-        $methodParameters = [
-            'requiredArgument1' => ['optional' => false, 'type' => 'string'],
-            'requiredArgument2' => ['optional' => false, 'type' => 'string']
-        ];
-
-        $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(): void
-    {
-        $methodParameters = [
-            'requiredArgument1' => ['optional' => false, 'type' => 'string'],
-            'requiredArgument2' => ['optional' => false, 'type' => 'string'],
-            'booleanOption' => ['optional' => true, 'type' => 'boolean']
-        ];
-
-        $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());
-    }
-
-    /**
-     * @test
-     */
-    public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign(): void
-    {
-        $methodParameters = [
-            'b1' => ['optional' => true, 'type' => 'boolean'],
-            'b2' => ['optional' => true, 'type' => 'boolean'],
-            'b3' => ['optional' => true, 'type' => 'boolean'],
-            'b4' => ['optional' => true, 'type' => 'boolean'],
-            'b5' => ['optional' => true, 'type' => 'boolean'],
-            'b6' => ['optional' => true, 'type' => 'boolean']
-        ];
-
-        $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());
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestTest.php
deleted file mode 100644 (file)
index a4333c3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Cli;
-
-/*                                                                        *
- * This script belongs to the Extbase framework.                            *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License as published by the *
- * Free Software Foundation, either version 3 of the License, or (at your *
- * option) any later version.                                             *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Test case
- */
-class RequestTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @test
-     */
-    public function setControllerObjectNameProperlyResolvesExtensionNameWithNamespaces()
-    {
-        $mockCliRequest = new \TYPO3\CMS\Extbase\Mvc\Cli\Request;
-        $mockCliRequest->setControllerObjectName('TYPO3\CMS\Extbase\Command\NamespacedMockCommandController');
-
-        $this->assertSame('Extbase', $mockCliRequest->getControllerExtensionName());
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php
deleted file mode 100644 (file)
index 0923e85..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Controller;
-
-/*
- * 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\Mvc\Exception\StopActionException;
-
-/**
- * Test case
- */
-class CommandControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Controller\CommandController|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
-     */
-    protected $commandController;
-
-    /**
-     * \Symfony\Component\Console\Output\ConsoleOutput|\PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $mockConsoleOutput;
-
-    protected function setUp()
-    {
-        $this->commandController = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\CommandController::class, ['dummyCommand']);
-        $this->mockConsoleOutput = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput::class)->disableOriginalConstructor()->getMock();
-        $this->commandController->_set('output', $this->mockConsoleOutput);
-    }
-
-    /**
-     * @test
-     */
-    public function outputAppendsGivenStringToTheResponseContent()
-    {
-        $this->mockConsoleOutput->expects($this->once())->method('output')->with('some text');
-        $this->commandController->_call('output', 'some text');
-    }
-
-    /**
-     * @test
-     */
-    public function outputReplacesArgumentsInGivenString()
-    {
-        $this->mockConsoleOutput->expects($this->once())->method('output')->with('%2$s %1$s', ['text', 'some']);
-        $this->commandController->_call('output', '%2$s %1$s', ['text', 'some']);
-    }
-
-    /**
-     * @test
-     */
-    public function quitThrowsStopActionException()
-    {
-        $this->expectException(StopActionException::class);
-        // @TODO expectExceptionCode is 0
-        $mockResponse = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
-        $this->commandController->_set('response', $mockResponse);
-        $this->commandController->_call('quit');
-    }
-
-    /**
-     * @test
-     */
-    public function quitSetsResponseExitCode()
-    {
-        $this->expectException(StopActionException::class);
-        // @TODO expectExceptionCode is 0
-        $mockResponse = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
-        $mockResponse->expects($this->once())->method('setExitCode')->with(123);
-        $this->commandController->_set('response', $mockResponse);
-        $this->commandController->_call('quit', 123);
-    }
-}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandManagerTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandManagerTest.php
new file mode 100644 (file)
index 0000000..cf221cb
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli;
+
+/*                                                                        *
+ * This script belongs to the Extbase framework.                            *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+use TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException;
+use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException;
+
+/**
+ * Test case
+ */
+class CommandManagerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     */
+    protected $mockObjectManager;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
+     */
+    protected $commandManager;
+
+    protected function setUp()
+    {
+        $this->commandManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class, ['getAvailableCommands']);
+        $this->mockObjectManager = $this->createMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+        $this->commandManager->_set('objectManager', $this->mockObjectManager);
+    }
+
+    /**
+     * @test
+     */
+    public function getAvailableCommandsReturnsAllAvailableCommands()
+    {
+        /** @var \TYPO3\TestingFramework\Core\AccessibleObjectInterface $commandManager */
+        $commandManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class, ['dummy']);
+        $commandManager->_set('objectManager', $this->mockObjectManager);
+        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'] = [
+            \TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockACommandController::class,
+            \TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockBCommandController::class
+        ];
+        $mockCommand1 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand2 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand3 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $this->mockObjectManager->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockACommandController::class, 'foo')->will($this->returnValue($mockCommand1));
+        $this->mockObjectManager->expects($this->at(1))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockACommandController::class, 'bar')->will($this->returnValue($mockCommand2));
+        $this->mockObjectManager->expects($this->at(2))->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockBCommandController::class, 'baz')->will($this->returnValue($mockCommand3));
+        $commands = $commandManager->getAvailableCommands();
+        $this->assertEquals(3, count($commands));
+        $this->assertSame($mockCommand1, $commands[0]);
+        $this->assertSame($mockCommand2, $commands[1]);
+        $this->assertSame($mockCommand3, $commands[2]);
+    }
+
+    /**
+     * @test
+     */
+    public function getCommandByIdentifierReturnsCommandIfIdentifierIsEqual()
+    {
+        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
+        $mockCommands = [$mockCommand];
+        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
+        $this->assertSame($mockCommand, $this->commandManager->getCommandByIdentifier('extensionkey:controller:command'));
+    }
+
+    /**
+     * @test
+     */
+    public function getCommandByIdentifierWorksCaseInsensitive()
+    {
+        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
+        $mockCommands = [$mockCommand];
+        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
+        $this->assertSame($mockCommand, $this->commandManager->getCommandByIdentifier('   ExtensionKey:conTroLler:Command  '));
+    }
+
+    /**
+     * @test
+     */
+    public function getCommandByIdentifierThrowsExceptionIfNoMatchingCommandWasFound()
+    {
+        $this->expectException(NoSuchCommandException::class);
+        $this->expectExceptionCode(1310556663);
+        $mockCommand = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
+        $mockCommands = [$mockCommand];
+        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
+        $this->commandManager->getCommandByIdentifier('extensionkey:controller:someothercommand');
+    }
+
+    /**
+     * @test
+     */
+    public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingCommandWasFound()
+    {
+        $this->expectException(AmbiguousCommandIdentifierException::class);
+        $this->expectExceptionCode(1310557169);
+        $mockCommand1 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
+        $mockCommand2 = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class);
+        $mockCommand2->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('otherextensionkey:controller:command'));
+        $mockCommands = [$mockCommand1, $mockCommand2];
+        $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
+        $this->commandManager->getCommandByIdentifier('controller:command');
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/CommandTest.php
new file mode 100644 (file)
index 0000000..3a2e4cf
--- /dev/null
@@ -0,0 +1,249 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli;
+
+/*
+ * 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\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Mvc\Cli\Command;
+use TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command\MockCCommandController;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
+
+/**
+ * Test case
+ */
+class CommandTest extends UnitTestCase
+{
+    /**
+     * @var bool Reset singletons created by subject
+     */
+    protected $resetSingletonInstances = true;
+
+    public function testIsCliOnly()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertFalse($commandController->isCliOnly());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'cliOnly'
+        );
+
+        static::assertTrue($commandController->isCliOnly());
+    }
+
+    /**
+     * @return array
+     */
+    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'],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider commandIdentifiers
+     * @param string $controllerClassName
+     * @param string $commandName
+     * @param string $expectedCommandIdentifier
+     */
+    public function constructRendersACommandIdentifierByTheGivenControllerAndCommandName($controllerClassName, $commandName, $expectedCommandIdentifier)
+    {
+        $command = new \TYPO3\CMS\Extbase\Mvc\Cli\Command($controllerClassName, $commandName);
+        $this->assertEquals($expectedCommandIdentifier, $command->getCommandIdentifier());
+    }
+
+    /**
+     * @return array
+     */
+    public function invalidCommandClassNames()
+    {
+        return [
+            [''],
+            // CommandClassName must not be empty
+            ['Foo']
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider invalidCommandClassNames
+     * @param string $controllerClassName
+     */
+    public function constructThrowsExceptionIfCommandClassNameIsInvalid($controllerClassName)
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1438782187);
+        new \TYPO3\CMS\Extbase\Mvc\Cli\Command($controllerClassName, 'foo');
+    }
+
+    public function testIsInternal()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertFalse($commandController->isInternal());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'internal'
+        );
+
+        static::assertTrue($commandController->isInternal());
+    }
+
+    public function testIsFlushinCaches()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertFalse($commandController->isFlushingCaches());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'flushingCaches'
+        );
+
+        static::assertTrue($commandController->isFlushingCaches());
+    }
+
+    public function testHasArguments()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertFalse($commandController->hasArguments());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'withArguments'
+        );
+
+        static::assertTrue($commandController->hasArguments());
+    }
+
+    public function testGetArgumentDefinitions()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertSame([], $commandController->getArgumentDefinitions());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'withArguments'
+        );
+
+        $expected = [
+            new CommandArgumentDefinition('foo', true, 'FooParamDescription'),
+            new CommandArgumentDefinition('bar', false, 'BarParamDescription'),
+        ];
+
+        static::assertEquals($expected, $commandController->getArgumentDefinitions());
+    }
+
+    public function testGetDescription()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertSame('', $commandController->getDescription());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'withDescription'
+        );
+
+        $expected = 'Longer Description' . LF .
+            'Multine' . LF . LF .
+            'Much Multiline';
+
+        static::assertEquals($expected, $commandController->getDescription());
+    }
+
+    public function testGetShortDescription()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertSame('', $commandController->getShortDescription());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'withDescription'
+        );
+
+        $expected = 'Short Description';
+
+        static::assertEquals($expected, $commandController->getShortDescription());
+    }
+
+    public function testGetRelatedCommandIdentifiers()
+    {
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'empty'
+        );
+
+        static::assertSame([], $commandController->getRelatedCommandIdentifiers());
+
+        $commandController = GeneralUtility::makeInstance(ObjectManager::class)->get(
+            Command::class,
+            MockCCommandController::class,
+            'relatedCommandIdentifiers'
+        );
+
+        $expected = ['Foo:Bar:Baz'];
+        static::assertEquals($expected, $commandController->getRelatedCommandIdentifiers());
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockACommandController.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockACommandController.php
new file mode 100644 (file)
index 0000000..4c1db50
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command;
+
+/*                                                                        *
+ * This script belongs to the Extbase framework.                            *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+/**
+ * A mock CLI Command
+ */
+class MockACommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
+{
+    public function fooCommand()
+    {
+    }
+
+    /**
+     * @param mixed $someArgument
+     */
+    public function barCommand($someArgument)
+    {
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockBCommandController.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockBCommandController.php
new file mode 100644 (file)
index 0000000..43aee27
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command;
+
+/**
+ * Another mock CLI Command
+ */
+class MockBCommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
+{
+    public function bazCommand()
+    {
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockCCommandController.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/Fixture/Command/MockCCommandController.php
new file mode 100644 (file)
index 0000000..e49eb9c
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli\Fixture\Command;
+
+/*
+ * 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!
+ */
+
+/**
+ * Another mock CLI Command
+ */
+class MockCCommandController extends \TYPO3\CMS\Extbase\Mvc\Cli\Command
+{
+    /**
+     * @cli
+     */
+    public function cliOnlyCommand()
+    {
+    }
+
+    public function emptyCommand()
+    {
+    }
+
+    /**
+     * @internal
+     */
+    public function internalCommand()
+    {
+    }
+
+    /**
+     * @flushesCaches
+     */
+    public function flushingCachesCommand()
+    {
+    }
+
+    /**
+     * @param string $foo FooParamDescription
+     * @param string $bar BarParamDescription
+     */
+    public function withArgumentsCommand($foo, $bar = 'baz')
+    {
+    }
+
+    /**
+     * Short Description
+     *
+     * Longer Description
+     * Multine
+     *
+     * Much Multiline
+     */
+    public function withDescriptionCommand()
+    {
+    }
+
+    /**
+     * @see Foo:Bar:Baz
+     */
+    public function relatedCommandIdentifiersCommand()
+    {
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestBuilderTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestBuilderTest.php
new file mode 100644 (file)
index 0000000..06325d4
--- /dev/null
@@ -0,0 +1,456 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli;
+
+/*                                                                        *
+ * This script belongs to the Extbase framework.                            *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentMixingException;
+use TYPO3\CMS\Extbase\Reflection\ClassSchema;
+
+/**
+ * Test case
+ */
+class RequestBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|\PHPUnit_Framework_Comparator_MockObject
+     */
+    protected $requestBuilder;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Cli\Request|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     */
+    protected $request;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     */
+    protected $mockObjectManager;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Cli\Command
+     */
+    protected $mockCommand;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
+     */
+    protected $mockCommandManager;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mockReflectionService;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mockConfigurationManager;
+
+    /**
+     * Sets up this test case
+     */
+    protected function setUp()
+    {
+        $this->request = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class, ['dummy']);
+        $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('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));
+        $this->mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
+        $this->mockConfigurationManager = $this->createMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
+        $this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::class, ['dummy']);
+        $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
+        $this->requestBuilder->_set('reflectionService', $this->mockReflectionService);
+        $this->requestBuilder->_set('commandManager', $this->mockCommandManager);
+        $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
+    }
+
+    /**
+     * Checks if a CLI request specifying a package, controller and action name results in the expected request object
+     *
+     * @test
+     */
+    public function cliAccessWithExtensionControllerAndActionNameBuildsCorrectRequest(): void
+    {
+        $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.');
+    }
+
+    /**
+     * @test
+     */
+    public function ifCommandCantBeResolvedTheHelpScreenIsShown()
+    {
+        // The following call is only made to satisfy PHPUnit. For some weird reason PHPUnit complains that the
+        // mocked method ("getObjectNameByClassName") does not exist _if the mock object is not used_.
+        $this->mockCommandManager->getCommandByIdentifier('some_extension_name:default:list');
+        $mockCommandManager = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
+        $mockCommandManager
+            ->expects($this->any())
+            ->method('getCommandByIdentifier')
+            ->with('test:default:list')
+            ->will(
+                $this->throwException(
+                new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException('testing', 1476050312)
+            )
+            );
+        $this->requestBuilder->_set('commandManager', $mockCommandManager);
+        $request = $this->requestBuilder->build('test:default:list');
+        $this->assertSame(\TYPO3\CMS\Extbase\Command\HelpCommandController::class, $request->getControllerObjectName());
+    }
+
+    /**
+     * @test
+     */
+    public function argumentWithValueSeparatedByEqualSignBuildsCorrectRequest(): void
+    {
+        $methodParameters = [
+            'testArgument' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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.');
+    }
+
+    /**
+     * Checks if a CLI request specifying some "console style" (--my-argument=value) arguments results in the expected request object
+     *
+     * @test
+     */
+    public function cliAccessWithExtensionControllerActionAndArgumentsBuildsCorrectRequest(): void
+    {
+        $methodParameters = [
+            'testArgument' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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.');
+        $this->assertEquals($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
+        $this->assertEquals($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
+    }
+
+    /**
+     * Checks if a CLI request specifying some "console style" (--my-argument =value) arguments with spaces between name and value results in the expected request object
+     *
+     * @test
+     */
+    public function checkIfCLIAccesWithPackageControllerActionAndArgumentsToleratesSpaces(): void
+    {
+        $methodParameters = [
+            'testArgument' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string'],
+            'testArgument3' => ['optional' => false, 'type' => 'string'],
+            'testArgument4' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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.');
+        $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
+        $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
+    }
+
+    /**
+     * Checks if a CLI request specifying some short "console style" (-c value or -c=value or -c = value) arguments results in the expected request object
+     *
+     * @test
+     */
+    public function CLIAccesWithShortArgumentsBuildsCorrectRequest(): void
+    {
+        $methodParameters = [
+            'a' => ['optional' => false, 'type' => 'string'],
+            'd' => ['optional' => false, 'type' => 'string'],
+            'f' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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.');
+        $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
+        $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
+        $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
+        $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
+    }
+
+    /**
+     * Checks if a CLI request specifying some mixed "console style" (-c or --my-argument -f=value) arguments with and
+     * without values results in the expected request object
+     *
+     * @test
+     */
+    public function CLIAccesWithArgumentsWithAndWithoutValuesBuildsCorrectRequest(): void
+    {
+        $methodParameters = [
+            'testArgument' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string'],
+            'testArgument3' => ['optional' => false, 'type' => 'string'],
+            'testArgument4' => ['optional' => false, 'type' => 'string'],
+            'testArgument5' => ['optional' => false, 'type' => 'string'],
+            'testArgument6' => ['optional' => false, 'type' => 'string'],
+            'testArgument7' => ['optional' => false, 'type' => 'string'],
+            'f' => ['optional' => false, 'type' => 'string'],
+            'd' => ['optional' => false, 'type' => 'string'],
+            'a' => ['optional' => false, 'type' => 'string'],
+            'c' => ['optional' => false, 'type' => 'string'],
+            'j' => ['optional' => false, 'type' => 'string'],
+            'k' => ['optional' => false, 'type' => 'string'],
+            'm' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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.');
+        $this->assertTrue($request->hasArgument('k'), 'The given "k" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument3'), 'The given "testArgument3" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument4'), 'The given "testArgument4" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('f'), 'The given "f" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('d'), 'The given "d" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('a'), 'The given "a" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('c'), 'The given "d" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument7'), 'The given "testArgument7" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument5'), 'The given "testArgument5" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('testArgument6'), 'The given "testArgument6" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('j'), 'The given "j" was not found in the built request.');
+        $this->assertTrue($request->hasArgument('m'), 'The given "m" was not found in the built request.');
+        $this->assertSame($request->getArgument('testArgument'), 'value', 'The "testArgument" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument2'), 'value2', 'The "testArgument2" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument3'), 'value3', 'The "testArgument3" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument4'), 'value4', 'The "testArgument4" had not the given value.');
+        $this->assertSame($request->getArgument('f'), 'valuef', 'The "f" had not the given value.');
+        $this->assertSame($request->getArgument('d'), 'valued', 'The "d" had not the given value.');
+        $this->assertSame($request->getArgument('a'), 'valuea', 'The "a" had not the given value.');
+        $this->assertSame($request->getArgument('testArgument5'), '5', 'The "testArgument4" had not the given value.');
+        $this->assertSame($request->getArgument('j'), 'kjk', 'The "j" had not the given value.');
+    }
+
+    /**
+     * @test
+     */
+    public function insteadOfNamedArgumentsTheArgumentsCanBePassedUnnamedInTheCorrectOrder(): void
+    {
+        $methodParameters = [
+            'testArgument1' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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'));
+        $request = $this->requestBuilder->build('some_extension_name:default:list firstArgumentValue secondArgumentValue');
+        $this->assertSame('firstArgumentValue', $request->getArgument('testArgument1'));
+        $this->assertSame('secondArgumentValue', $request->getArgument('testArgument2'));
+    }
+
+    /**
+     * @test
+     */
+    public function argumentsAreDetectedAfterOptions(): void
+    {
+        $methodParameters = [
+            'some' => ['optional' => true, 'type' => 'boolean'],
+            'option' => ['optional' => true, 'type' => 'string'],
+            'argument1' => ['optional' => false, 'type' => 'string'],
+            'argument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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'));
+        $this->assertSame('file1', $request->getArgument('argument1'));
+        $this->assertSame('file2', $request->getArgument('argument2'));
+    }
+
+    /**
+     * @test
+     */
+    public function exceedingArgumentsMayBeSpecified(): void
+    {
+        $methodParameters = [
+            'testArgument1' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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());
+        $this->assertEquals(['exceedingArgument1'], $request->getExceedingArguments());
+    }
+
+    /**
+     * @test
+     */
+    public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed(): void
+    {
+        $this->expectException(InvalidArgumentMixingException::class);
+        $this->expectExceptionCode(1309971820);
+        $methodParameters = [
+            'testArgument1' => ['optional' => false, 'type' => 'string'],
+            'testArgument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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(): void
+    {
+        $this->expectException(InvalidArgumentMixingException::class);
+        $this->expectExceptionCode(1309971821);
+        $methodParameters = [
+            'requiredArgument1' => ['optional' => false, 'type' => 'string'],
+            'requiredArgument2' => ['optional' => false, 'type' => 'string']
+        ];
+
+        $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(): void
+    {
+        $methodParameters = [
+            'requiredArgument1' => ['optional' => false, 'type' => 'string'],
+            'requiredArgument2' => ['optional' => false, 'type' => 'string'],
+            'booleanOption' => ['optional' => true, 'type' => 'boolean']
+        ];
+
+        $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());
+    }
+
+    /**
+     * @test
+     */
+    public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign(): void
+    {
+        $methodParameters = [
+            'b1' => ['optional' => true, 'type' => 'boolean'],
+            'b2' => ['optional' => true, 'type' => 'boolean'],
+            'b3' => ['optional' => true, 'type' => 'boolean'],
+            'b4' => ['optional' => true, 'type' => 'boolean'],
+            'b5' => ['optional' => true, 'type' => 'boolean'],
+            'b6' => ['optional' => true, 'type' => 'boolean']
+        ];
+
+        $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());
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Cli/RequestTest.php
new file mode 100644 (file)
index 0000000..31e5505
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Cli;
+
+/*                                                                        *
+ * This script belongs to the Extbase framework.                            *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version.                                             *
+ *                                                                        *
+ * This script is distributed in the hope that it will be useful, but     *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
+ * General Public License for more details.                               *
+ *                                                                        *
+ * You should have received a copy of the GNU Lesser General Public       *
+ * License along with the script.                                         *
+ * If not, see http://www.gnu.org/licenses/lgpl.html                      *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Test case
+ */
+class RequestTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * @test
+     */
+    public function setControllerObjectNameProperlyResolvesExtensionNameWithNamespaces()
+    {
+        $mockCliRequest = new \TYPO3\CMS\Extbase\Mvc\Cli\Request;
+        $mockCliRequest->setControllerObjectName('TYPO3\CMS\Extbase\Command\NamespacedMockCommandController');
+
+        $this->assertSame('Extbase', $mockCliRequest->getControllerExtensionName());
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Controller/CommandControllerTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Controller/CommandControllerTest.php
new file mode 100644 (file)
index 0000000..e225f34
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Controller;
+
+/*
+ * 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\Mvc\Exception\StopActionException;
+
+/**
+ * Test case
+ */
+class CommandControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Controller\CommandController|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     */
+    protected $commandController;
+
+    /**
+     * \Symfony\Component\Console\Output\ConsoleOutput|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mockConsoleOutput;
+
+    protected function setUp()
+    {
+        $this->commandController = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\CommandController::class, ['dummyCommand']);
+        $this->mockConsoleOutput = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput::class)->disableOriginalConstructor()->getMock();
+        $this->commandController->_set('output', $this->mockConsoleOutput);
+    }
+
+    /**
+     * @test
+     */
+    public function outputAppendsGivenStringToTheResponseContent()
+    {
+        $this->mockConsoleOutput->expects($this->once())->method('output')->with('some text');
+        $this->commandController->_call('output', 'some text');
+    }
+
+    /**
+     * @test
+     */
+    public function outputReplacesArgumentsInGivenString()
+    {
+        $this->mockConsoleOutput->expects($this->once())->method('output')->with('%2$s %1$s', ['text', 'some']);
+        $this->commandController->_call('output', '%2$s %1$s', ['text', 'some']);
+    }
+
+    /**
+     * @test
+     */
+    public function quitThrowsStopActionException()
+    {
+        $this->expectException(StopActionException::class);
+        // @TODO expectExceptionCode is 0
+        $mockResponse = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
+        $this->commandController->_set('response', $mockResponse);
+        $this->commandController->_call('quit');
+    }
+
+    /**
+     * @test
+     */
+    public function quitSetsResponseExitCode()
+    {
+        $this->expectException(StopActionException::class);
+        // @TODO expectExceptionCode is 0
+        $mockResponse = $this->createMock(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
+        $mockResponse->expects($this->once())->method('setExitCode')->with(123);
+        $this->commandController->_set('response', $mockResponse);
+        $this->commandController->_call('quit', 123);
+    }
+}
index 2106549..4755145 100644 (file)
@@ -32,8 +32,10 @@ unset($extbaseObjectContainer);
 \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter(\TYPO3\CMS\Extbase\Property\TypeConverter\FolderConverter::class);
 
 // register help command
+// @deprecated will be removed in TYPO3 v10.0. Use symfony/console commands instead
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = \TYPO3\CMS\Extbase\Command\HelpCommandController::class;
 
+// @deprecated will be removed in TYPO3 v10.0. Use symfony/console commands instead
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Extbase\Scheduler\Task::class] = [
     'extension' => 'extbase',
     'title' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xlf:task.name',
index 0eb0c73..ae55111 100644 (file)
@@ -3,6 +3,7 @@ config.tx_extbase {
                requestHandlers {
                        TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler = TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler
                        TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler = TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler
+      // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Use symfony/console commands instead.
                        TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler = TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler
                }
                throwPageNotFoundExceptionIfActionCantBeResolved = 0
index 2407b45..3005819 100644 (file)
@@ -175,4 +175,9 @@ return [
             'Deprecation-85878-EidUtilityAndVariousTSFEMethods.rst',
         ],
     ],
+    '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'extbase\'][\'commandControllers\']' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
 ];
index 38aa94b..51368c8 100644 (file)
@@ -839,4 +839,89 @@ return [
             'Deprecation-85902-IMGMENUGMENU.rst',
         ],
     ],
+    'TYPO3\CMS\Extbase\Command\CoreCommand' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Command\ExtbaseCommand' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Command\HelpCommand' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Command\HelpCommandController' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\Command' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\CommandManager' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\Request' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Cli\RequestHandler' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Controller\CommandController' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Mvc\Exception\CommandException' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Scheduler\FieldProvider' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Scheduler\Task' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
+    'TYPO3\CMS\Extbase\Scheduler\TaskExecutor' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
 ];
index 3aafed7..1b994c0 100644 (file)
@@ -6,4 +6,9 @@ return [
             'Deprecation-83094-ReplaceIgnorevalidationWithTYPO3CMSExtbaseAnnotationIgnoreValidation.rst',
         ],
     ],
+    '@cli' => [
+        'restFiles' => [
+            'Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.rst',
+        ],
+    ],
 ];
index eb63ff7..f01a1e4 100644 (file)
@@ -20,10 +20,10 @@ use Symfony\Component\Console\Exception\InvalidArgumentException;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputDefinition;
 use TYPO3\CMS\Core\Console\CommandRegistry;
+use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Lang\LanguageService;
 use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface;
 use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;
 use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
@@ -34,16 +34,11 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
 class ExecuteSchedulableCommandAdditionalFieldProvider implements AdditionalFieldProviderInterface
 {
     /**
-     * @var array|Command[]
+     * @var Command[]
      */
     protected $schedulableCommands = [];
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
-     */
-    protected $commandManager;
-
-    /**
      * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
      */
     protected $objectManager;
index 0764ca0..366834e 100644 (file)
@@ -19,8 +19,8 @@ use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Output\NullOutput;
 use TYPO3\CMS\Core\Console\CommandRegistry;
 use TYPO3\CMS\Core\Console\UnknownCommandException;
+use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Class TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask