[TASK] Show case sensitive command identifier 15/48615/2
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 20 Jun 2016 17:46:23 +0000 (19:46 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 20 Jul 2016 21:18:09 +0000 (23:18 +0200)
Instead of using strtolower() use the names of the commands as
provided by the CommandController. This improves the readability
a lot.

Resolves: #76712
Releases: master
Change-Id: Ie85146dc8dbdabd4901996b7324ac476b7d78fdf
Reviewed-on: https://review.typo3.org/48615
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php
typo3/sysext/extbase/Classes/Mvc/Cli/CommandManager.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php

index 57eadba..7e8fc02 100644 (file)
@@ -108,7 +108,7 @@ class Command
 
         $this->extensionName = $classNameParts[1];
         $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName);
-        $this->commandIdentifier = strtolower($extensionKey . ':' . substr($classNameParts[$numberOfClassNameParts - 1], 0, -17) . ':' . $controllerCommandName);
+        $this->commandIdentifier = ($extensionKey . ':' . substr($classNameParts[$numberOfClassNameParts - 1], 0, -17) . ':' . $controllerCommandName);
     }
 
     /**
index 92b3f6b..3c99f73 100644 (file)
@@ -162,8 +162,8 @@ class CommandManager implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function commandMatchesIdentifier(Command $command, $commandIdentifier)
     {
-        $commandIdentifierParts = explode(':', $command->getCommandIdentifier());
-        $searchedCommandIdentifierParts = explode(':', $commandIdentifier);
+        $commandIdentifierParts = explode(':', strtolower($command->getCommandIdentifier()));
+        $searchedCommandIdentifierParts = explode(':', strtolower($commandIdentifier));
         $extensionKey = array_shift($commandIdentifierParts);
         if (count($searchedCommandIdentifierParts) === 3) {
             $searchedExtensionKey = array_shift($searchedCommandIdentifierParts);
index 436ae09..9c09037 100644 (file)
@@ -59,9 +59,9 @@ class CommandTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     public function commandIdentifiers()
     {
         return array(
-            array('Tx_ExtensionKey_Command_CacheCommandController', 'flush', 'extension_key:cache:flush'),
-            array('Tx_Ext_Command_CookieCommandController', 'bake', 'ext:cookie:bake'),
-            array('Tx_OtherExtensionKey_Foo_Faa_Fuuum_Command_CoffeeCommandController', 'brew', 'other_extension_key:coffee:brew'),
+            array('Tx_ExtensionKey_Command_CacheCommandController', 'flush', 'extension_key:Cache:flush'),
+            array('Tx_Ext_Command_CookieCommandController', 'bake', 'ext:Cookie:bake'),
+            array('Tx_OtherExtensionKey_Foo_Faa_Fuuum_Command_CoffeeCommandController', 'brew', 'other_extension_key:Coffee:brew'),
         );
     }