[TASK] Don't process vendor names in extbase and fluid 22/59622/4
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sat, 2 Feb 2019 13:39:07 +0000 (14:39 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 23 Feb 2019 20:30:01 +0000 (21:30 +0100)
Since the controller class of a given plugin or module
is no longer guessed by looking at the class namespace,
the vendor of classes is no longer relevant.

Releases: master
Resolves: #87626
Change-Id: Ic1464f413634ed4e1e46ba1701d1bebbc8556da3
Reviewed-on: https://review.typo3.org/c/59622
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
18 files changed:
typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/ExtbaseJsonRenderer.typoscript
typo3/sysext/extbase/Classes/Core/Bootstrap.php
typo3/sysext/extbase/Classes/Mvc/Request.php
typo3/sysext/extbase/Classes/Mvc/Web/ReferringRequest.php
typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/Frontend/ContentJsonRenderer.typoscript
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/Frontend/JsonRenderer.typoscript
typo3/sysext/extbase/Tests/Unit/Mvc/RequestTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/RequestBuilderTest.php
typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/ExtbaseController.ts
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/ExtbasePlugin.ts
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/ExtbaseTwoPlugins.ts
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FormViewHelperTest.php

index a34fe0f..feccf9b 100644 (file)
@@ -44,7 +44,6 @@ class BackendLogModuleBootstrap
         }
         $options['moduleConfiguration'] = [
             'extensionName' => 'Belog',
-            'vendorName' => 'TYPO3\\CMS',
         ];
         $options['moduleName'] = 'system_BelogLog';
 
index 22a01a8..be18d59 100644 (file)
@@ -8,7 +8,6 @@ page {
                        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
                        extensionName = IrreTutorial
                        pluginName = Irre
-                       vendorName = OliverHader
                }
                stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->parseValues
                stdWrap.postUserFunc.as = Extbase
index f15204a..4b19dea 100644 (file)
@@ -66,9 +66,6 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
     public function initialize(array $configuration): void
     {
         if (!Environment::isCli()) {
-            if (!isset($configuration['vendorName']) || $configuration['vendorName'] === '') {
-                throw new \RuntimeException('Invalid configuration: "vendorName" is not set', 1526629315);
-            }
             if (!isset($configuration['extensionName']) || $configuration['extensionName'] === '') {
                 throw new \RuntimeException('Invalid configuration: "extensionName" is not set', 1290623020);
             }
@@ -107,7 +104,7 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
         $this->configurationManager->setConfiguration($configuration);
         // todo: Shouldn't the configuration manager object – which is a singleton – be stateless?
         // todo: At this point we give the configuration manager a state, while we could directly pass the
-        // todo: configuration (i.e. controllerName, actionName, vendorName and such), directly to the request
+        // todo: configuration (i.e. controllerName, actionName and such), directly to the request
         // todo: handler, which then creates stateful request objects.
         // todo: Once this has changed, \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::loadDefaultValues does not need
         // todo: to fetch this configuration from the configuration manager.
@@ -179,9 +176,6 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
             'extensionName' => $moduleConfiguration['extensionName'],
             'pluginName' => $route->getOption('moduleName')
         ];
-        if (isset($moduleConfiguration['vendorName'])) {
-            $configuration['vendorName'] = $moduleConfiguration['vendorName'];
-        }
 
         $this->initialize($configuration);
 
index 2e45f37..cdb4f95 100644 (file)
@@ -34,11 +34,6 @@ class Request implements RequestInterface
     protected $controllerExtensionName;
 
     /**
-     * @var string vendor prefix
-     */
-    protected $controllerVendorName;
-
-    /**
      * Subpackage key of the controller which is supposed to handle this request.
      *
      * @var string
@@ -148,7 +143,6 @@ class Request implements RequestInterface
     public function setControllerObjectName($controllerObjectName)
     {
         $nameParts = ClassNamingUtility::explodeObjectControllerName($controllerObjectName);
-        $this->controllerVendorName = $nameParts['vendorName'] ?? null;
         $this->controllerExtensionName = $nameParts['extensionName'];
         $this->controllerSubpackageKey = $nameParts['subpackageKey'] ?? null;
         $this->controllerName = $nameParts['controllerName'];
@@ -345,34 +339,12 @@ class Request implements RequestInterface
             $this->internalArguments[$argumentName] = $value;
             return;
         }
-        if (!in_array($argumentName, ['@extension', '@subpackage', '@controller', '@action', '@format', '@vendor'], true)) {
+        if (!in_array($argumentName, ['@extension', '@subpackage', '@controller', '@action', '@format'], true)) {
             $this->arguments[$argumentName] = $value;
         }
     }
 
     /**
-     * sets the VendorName
-     *
-     * @param string $vendorName
-     * @internal only to be used within Extbase, not part of TYPO3 Core API.
-     */
-    public function setControllerVendorName($vendorName)
-    {
-        $this->controllerVendorName = $vendorName;
-    }
-
-    /**
-     * get the VendorName
-     *
-     * @return string
-     * @internal only to be used within Extbase, not part of TYPO3 Core API.
-     */
-    public function getControllerVendorName()
-    {
-        return $this->controllerVendorName;
-    }
-
-    /**
      * Sets the whole arguments array and therefore replaces any arguments
      * which existed before.
      *
index fbcf360..1a6bfde 100644 (file)
@@ -45,9 +45,6 @@ class ReferringRequest extends Request
             case '@format':
                 $this->setFormat($value);
                 break;
-            case '@vendor':
-                $this->setControllerVendorName($value);
-                break;
         }
     }
 }
index c71e397..f7d1180 100644 (file)
@@ -33,13 +33,6 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
     protected $objectManager;
 
     /**
-     * This is the vendor name of the extension
-     *
-     * @var string
-     */
-    protected $vendorName;
-
-    /**
      * This is a unique key for a plugin (not the extension key!)
      *
      * @var string
@@ -158,11 +151,6 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
         if (empty($configuration['pluginName'])) {
             throw new MvcException('"pluginName" is not properly configured. Request can\'t be dispatched!', 1289843277);
         }
-        if (!empty($configuration['vendorName'])) {
-            $this->vendorName = $configuration['vendorName'];
-        } else {
-            $this->vendorName = null;
-        }
         $this->extensionName = $configuration['extensionName'];
         $this->pluginName = $configuration['pluginName'];
         $defaultControllerConfiguration = reset($configuration['controllerConfiguration']) ?? [];
@@ -214,10 +202,6 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
         $actionName = $this->resolveActionName($controllerClassName, $parameters);
         /** @var \TYPO3\CMS\Extbase\Mvc\Web\Request $request */
         $request = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Request::class);
-        if ($this->vendorName !== null) {
-            // Still needed for the fucking viewObjectNamePattern in ActionController
-            $request->setControllerVendorName($this->vendorName);
-        }
         $request->setPluginName($this->pluginName);
         $request->setControllerExtensionName($this->extensionName);
         $request->setControllerAliasToClassNameMapping($this->controllerAliasToClassMapping);
index 3a2afd2..9ddfce8 100644 (file)
@@ -114,7 +114,7 @@ tt_content.list.20.' . $pluginSignature . ' = USER
 tt_content.list.20.' . $pluginSignature . ' {
        userFunc = TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run
        extensionName = ' . $extensionName . '
-       pluginName = ' . $pluginName . (null !== $vendorName ? ("\n\t" . 'vendorName = ' . $vendorName) : '') . '
+       pluginName = ' . $pluginName . '
 }');
                 break;
             case self::PLUGIN_TYPE_CONTENT_ELEMENT:
@@ -126,7 +126,7 @@ tt_content.' . $pluginSignature . ' {
     20 {
         userFunc = TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run
         extensionName = ' . $extensionName . '
-        pluginName = ' . $pluginName . (null !== $vendorName ? ("\n\t\t" . 'vendorName = ' . $vendorName) : '') . '
+        pluginName = ' . $pluginName . '
     }
 }');
                 break;
@@ -256,9 +256,6 @@ tt_content.' . $pluginSignature . ' {
                 'actions' => \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $actionsList)
             ];
         }
-        if (null !== $vendorName) {
-            $moduleConfiguration['vendorName'] = $vendorName;
-        }
         \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule($mainModuleName, $subModuleName, $position, null, $moduleConfiguration);
     }
 
index af99292..1d12288 100644 (file)
@@ -51,7 +51,6 @@ class ActionControllerTest extends \TYPO3\TestingFramework\Core\Functional\Funct
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
 
         $this->request = $objectManager->get(Request::class);
-        $this->request->setControllerVendorName('TYPO3\\CMS');
         $this->request->setPluginName('Pi1');
         $this->request->setControllerExtensionName('Extbase\\Tests\\Functional\\Mvc\\Controller\\Fixture');
         $this->request->setControllerName('Test');
index 7a39272..cd6a5f1 100644 (file)
@@ -73,7 +73,6 @@ class ControllerArgumentsMappingTest extends \TYPO3\TestingFramework\Core\Functi
         $configurationManager = $objectManager->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
         $configurationManager->setConfiguration($configuration);
         $this->request = $objectManager->get(Request::class);
-        $this->request->setControllerVendorName('ExtbaseTeam\\BlogExample');
         $this->request->setPluginName('Pi1');
         $this->request->setControllerExtensionName(BlogController::class);
         $this->request->setControllerName('Blog');
index 74e476f..313af76 100644 (file)
@@ -25,7 +25,6 @@ page {
                        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
                        extensionName = BlogExample
                        pluginName = Content
-                       vendorName = ExtbaseTeam
                }
                stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->parseValues
                stdWrap.postUserFunc.as = Extbase
index 5ebdee0..abd22f7 100644 (file)
@@ -27,7 +27,6 @@ page {
                        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
                        extensionName = BlogExample
                        pluginName = Blogs
-                       vendorName = ExtbaseTeam
                }
                stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->parseValues
                stdWrap.postUserFunc.as = Extbase
index c187dbc..d999f5f 100644 (file)
@@ -147,19 +147,6 @@ class RequestTest extends UnitTestCase
     /**
      * @test
      */
-    public function setArgumentShouldSetVendorIfVendorIsGiven()
-    {
-        $request = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\Request::class)
-            ->setMethods(['setFormat', 'setVendor'])
-            ->getMock();
-        $request->expects($this->any())->method('setVendor')->with('VENDOR');
-        $request->setArgument('@vendor', 'VENDOR');
-        $this->assertFalse($request->hasArgument('@vendor'));
-    }
-
-    /**
-     * @test
-     */
     public function internalArgumentsShouldNotBeReturnedAsNormalArgument()
     {
         $request = new \TYPO3\CMS\Extbase\Mvc\Request();
@@ -268,7 +255,6 @@ class RequestTest extends UnitTestCase
         return [
             'Vendor TYPO3\CMS, extension, controller given' => [
                 [
-                    'vendorName' => 'TYPO3\\CMS',
                     'extensionName' => 'Ext',
                     'subpackageKey' => '',
                     'controllerName' => 'Foo',
@@ -277,7 +263,6 @@ class RequestTest extends UnitTestCase
             ],
             'Vendor TYPO3\CMS, extension, subpackage, controlle given' => [
                 [
-                    'vendorName' => 'TYPO3\\CMS',
                     'extensionName' => 'Fluid',
                     'subpackageKey' => 'ViewHelpers\\Widget',
                     'controllerName' => 'Paginate',
@@ -286,7 +271,6 @@ class RequestTest extends UnitTestCase
             ],
             'Vendor VENDOR, extension, controller given' => [
                 [
-                    'vendorName' => 'VENDOR',
                     'extensionName' => 'Ext',
                     'subpackageKey' => '',
                     'controllerName' => 'Foo',
@@ -295,7 +279,6 @@ class RequestTest extends UnitTestCase
             ],
             'Vendor VENDOR, extension subpackage, controller given' => [
                 [
-                    'vendorName' => 'VENDOR',
                     'extensionName' => 'Ext',
                     'subpackageKey' => 'ViewHelpers\\Widget',
                     'controllerName' => 'Foo',
@@ -319,7 +302,6 @@ class RequestTest extends UnitTestCase
         $request->setControllerObjectName($controllerObjectName);
 
         $actualControllerArguments = [
-            'vendorName' => $request->_get('controllerVendorName'),
             'extensionName' => $request->_get('controllerExtensionName'),
             'subpackageKey' => $request->_get('controllerSubpackageKey'),
             'controllerName' => $request->_get('controllerName'),
index 8b2551c..c5f8e42 100644 (file)
@@ -212,47 +212,6 @@ class RequestBuilderTest extends UnitTestCase
     /**
      * @test
      */
-    public function buildSetsVendorNameIfConfigured(): void
-    {
-        $this->injectDependencies();
-        $expectedVendor = 'Vendor';
-        $this->configuration['vendorName'] = $expectedVendor;
-        $mockConfigurationManager = $this->createMock(ConfigurationManagerInterface::class);
-        $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
-        $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
-        $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
-        $this->mockRequest->expects($this->once())->method('setControllerVendorName')->with($expectedVendor);
-        $this->requestBuilder->build();
-    }
-
-    /**
-     * @test
-     */
-    public function buildDoesNotSetVendorNameIfNotConfiguredInSecondRequest(): void
-    {
-        $this->injectDependencies();
-        $expectedVendor = 'Vendor';
-        $this->configuration['vendorName'] = $expectedVendor;
-
-        $mockConfigurationManager = $this->createMock(ConfigurationManagerInterface::class);
-        $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
-        $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
-        $this->mockRequest->expects($this->once())->method('setControllerVendorName')->with($expectedVendor);
-
-        $this->requestBuilder->build();
-
-        unset($this->configuration['vendorName']);
-        $mockConfigurationManager = $this->createMock(ConfigurationManagerInterface::class);
-        $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
-        $this->requestBuilder->_set('configurationManager', $mockConfigurationManager);
-
-        $this->mockRequest->expects($this->never())->method('setControllerVendorName');
-        $this->requestBuilder->build();
-    }
-
-    /**
-     * @test
-     */
     public function buildThrowsExceptionIfExtensionNameIsNotConfigured(): void
     {
         $this->expectException(Exception::class);
index ac2ab8d..93d2ef8 100644 (file)
@@ -249,7 +249,6 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
     {
         $request = $this->renderingContext->getControllerContext()->getRequest();
         $extensionName = $request->getControllerExtensionName();
-        $vendorName = $request->getControllerVendorName();
         $controllerName = $request->getControllerName();
         $actionName = $request->getControllerActionName();
         $actionRequest = [
@@ -260,10 +259,6 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
 
         $result = LF;
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@extension]') . '" value="' . $extensionName . '" />' . LF;
-        if ($vendorName !== null) {
-            $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@vendor]') . '" value="' . $vendorName . '" />' . LF;
-            $actionRequest['@vendor'] = $vendorName;
-        }
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@controller]') . '" value="' . $controllerName . '" />' . LF;
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@action]') . '" value="' . $actionName . '" />' . LF;
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[arguments]') . '" value="' . htmlspecialchars($this->hashService->appendHmac(base64_encode(serialize($request->getArguments())))) . '" />' . LF;
index 775c1c2..8b76169 100644 (file)
@@ -3,7 +3,6 @@ page.10 {
     userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
     extensionName = FluidTest
     pluginName = Pi
-    vendorName = TYPO3Fluid
 }
 
 [request.getQueryParams()['pluginConfig'] == 'extensionKey' || request.getParsedBody()['pluginConfig'] == 'extensionKey']
index 443f694..e2a9d0f 100644 (file)
@@ -253,11 +253,9 @@ class FormViewHelperTest extends ViewHelperBaseTestcase
         $this->request->getControllerExtensionName()->willReturn('extensionName');
         $this->request->getControllerName()->willReturn('controllerName');
         $this->request->getControllerActionName()->willReturn('controllerActionName');
-        $this->request->getControllerVendorName()->willReturn('controllerVendorName');
         $this->request->getArguments()->willReturn([]);
         $hiddenFields = $viewHelper->_call('renderHiddenReferrerFields');
         $expectedResult =  \chr(10) . '<input type="hidden" name="__referrer[@extension]" value="extensionName" />'
-            . \chr(10) . '<input type="hidden" name="__referrer[@vendor]" value="controllerVendorName" />'
             . \chr(10) . '<input type="hidden" name="__referrer[@controller]" value="controllerName" />'
             . \chr(10) . '<input type="hidden" name="__referrer[@action]" value="controllerActionName" />'
             . \chr(10) . '<input type="hidden" name="__referrer[arguments]" value="" />'