diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php b/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php index 01671561c9fa3f66c05be1e109a06ccfd4f5b3dc..b52210e900c3a4ce66dbb63e6a2968fec19bd173 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php @@ -15,6 +15,7 @@ namespace TYPO3\CMS\Frontend\ContentObject; +use Psr\Container\ContainerInterface; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -23,6 +24,13 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; */ class ContentDataProcessor { + private ContainerInterface $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + /** * Check for the availability of processors, defined in TypoScript, and use them for data processing * @@ -42,22 +50,9 @@ class ContentDataProcessor $processorKeys = ArrayUtility::filterAndSortByNumericKeys($processors); foreach ($processorKeys as $key) { - $className = $processors[$key]; - if (!class_exists($className)) { - throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378); - } - - if (!in_array(DataProcessorInterface::class, class_implements($className) ?: [], true)) { - throw new \UnexpectedValueException( - 'Processor with class name "' . $className . '" ' . - 'must implement interface "' . DataProcessorInterface::class . '"', - 1427455377 - ); - } - + $dataProcessor = $this->getDataProcessor($processors[$key]); $processorConfiguration = $processors[$key . '.'] ?? []; - - $variables = GeneralUtility::makeInstance($className)->process( + $variables = $dataProcessor->process( $cObject, $configuration, $processorConfiguration, @@ -68,4 +63,38 @@ class ContentDataProcessor return $variables; } + + private function getDataProcessor(string $serviceName): DataProcessorInterface + { + if (!$this->container->has($serviceName)) { + // assume serviceName is the class name if it is not available in the container + return $this->instantiateDataProcessor($serviceName); + } + + $dataProcessor = $this->container->get($serviceName); + if (!$dataProcessor instanceof DataProcessorInterface) { + throw new \UnexpectedValueException( + 'Processor with service name "' . $serviceName . '" ' . + 'must implement interface "' . DataProcessorInterface::class . '"', + 1635927108 + ); + } + return $dataProcessor; + } + + private function instantiateDataProcessor(string $className): DataProcessorInterface + { + if (!class_exists($className)) { + throw new \UnexpectedValueException('Processor class or service name "' . $className . '" does not exist!', 1427455378); + } + + if (!in_array(DataProcessorInterface::class, class_implements($className) ?: [], true)) { + throw new \UnexpectedValueException( + 'Processor with class name "' . $className . '" ' . + 'must implement interface "' . DataProcessorInterface::class . '"', + 1427455377 + ); + } + return GeneralUtility::makeInstance($className); + } } diff --git a/typo3/sysext/frontend/Configuration/Services.yaml b/typo3/sysext/frontend/Configuration/Services.yaml index be4f789c40cf40d48282f917b00955f6cb2667b7..30b26d68c75cafe490a154ed4c65a625d5f59a78 100644 --- a/typo3/sysext/frontend/Configuration/Services.yaml +++ b/typo3/sysext/frontend/Configuration/Services.yaml @@ -18,6 +18,9 @@ services: version: '11.5' message: 'Injection of "%service_id%" breaks subrequests. Please use the PSR-7 request attribute "frontend.controller".' + TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor: + public: true + TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer: public: true shared: false diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentDataProcessorTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentDataProcessorTest.php index 227f1440114c975406857f683aa5f27fc175b3b2..e4189e1f599eabe835b6b722667eedd9878bd5b2 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentDataProcessorTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentDataProcessorTest.php @@ -17,6 +17,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject; +use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; +use Prophecy\Prophecy\ObjectProphecy; +use Psr\Container\ContainerInterface; use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Fixtures\DataProcessorFixture; @@ -27,21 +31,32 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class ContentDataProcessorTest extends UnitTestCase { + use ProphecyTrait; + protected ContentDataProcessor $contentDataProcessor; + /** + * @var ObjectProphecy|ContainerInterface + */ + protected ObjectProphecy $containerProphecy; + /** * Set up */ protected function setUp(): void { parent::setUp(); - $this->contentDataProcessor = new ContentDataProcessor(); + $this->containerProphecy = $this->prophesize(ContainerInterface::class); + $this->containerProphecy->has(Argument::any())->willReturn(false); + $this->contentDataProcessor = new ContentDataProcessor( + $this->containerProphecy->reveal() + ); } /** * @test */ - public function throwsExceptionIfProcessorClassDoesNotExist(): void + public function throwsExceptionIfProcessorDoesNotExist(): void { $this->expectException(\UnexpectedValueException::class); $this->expectExceptionCode(1427455378); @@ -75,7 +90,7 @@ class ContentDataProcessorTest extends UnitTestCase /** * @test */ - public function processorIsCalled(): void + public function processorClassIsCalled(): void { $contentObjectRendererStub = new ContentObjectRenderer(); $config = [ @@ -90,4 +105,44 @@ class ContentDataProcessorTest extends UnitTestCase $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables) ); } + + /** + * @test + */ + public function throwsExceptionIfProcessorServiceDoesNotImplementInterface(): void + { + $this->expectException(\UnexpectedValueException::class); + $this->expectExceptionCode(1635927108); + $contentObjectRendererStub = new ContentObjectRenderer(); + $this->containerProphecy->has(static::class)->willReturn(true); + $this->containerProphecy->get(static::class)->willReturn($this); + $config = [ + 'dataProcessing.' => [ + '10' => static::class, + ], + ]; + $variables = []; + $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables); + } + + /** + * @test + */ + public function processorServiceIsCalled(): void + { + $contentObjectRendererStub = new ContentObjectRenderer(); + $this->containerProphecy->has('dataProcessorFixture')->willReturn(true); + $this->containerProphecy->get('dataProcessorFixture')->willReturn(new DataProcessorFixture()); + $config = [ + 'dataProcessing.' => [ + '10' => 'dataProcessorFixture', + '10.' => ['foo' => 'bar'], + ], + ]; + $variables = []; + self::assertSame( + ['foo' => 'bar'], + $this->contentDataProcessor->process($contentObjectRendererStub, $config, $variables) + ); + } } diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index 7ab3a160c1995c343337537219256bb8d3972d98..61f49bee045b1293511ac6a7e46ddf8062d3789f 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -22,6 +22,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; +use Psr\Container\ContainerInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Log\NullLogger; use TYPO3\CMS\Core\Cache\CacheManager; @@ -54,6 +55,7 @@ use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject; use TYPO3\CMS\Frontend\ContentObject\CaseContentObject; use TYPO3\CMS\Frontend\ContentObject\ContentContentObject; +use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayContentObject; use TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayInternalContentObject; use TYPO3\CMS\Frontend\ContentObject\ContentObjectGetImageResourceHookInterface; @@ -393,6 +395,9 @@ class ContentObjectRendererTest extends UnitTestCase self::assertTrue( is_subclass_of($className, AbstractContentObject::class) ); + if ($objectName === 'FLUIDTEMPLATE') { + GeneralUtility::addInstance(ContentDataProcessor::class, new ContentDataProcessor($this->prophesize(ContainerInterface::class)->reveal())); + } $object = $this->subject->getContentObject($objectName); self::assertInstanceOf($className, $object); } diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php index a50442587c9c0ac70a1d290ac6b427762bf49d1c..751715f9f8b1ee5e76761dff6429846950deb8da 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php @@ -22,6 +22,7 @@ use Prophecy\Argument; use Prophecy\Doubler\Generator\Node\ReturnTypeNode; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; +use Psr\Container\ContainerInterface; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\TypoScript\TemplateService; @@ -29,6 +30,7 @@ use TYPO3\CMS\Core\TypoScript\TypoScriptService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Request; use TYPO3\CMS\Fluid\View\StandaloneView; +use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; @@ -61,6 +63,11 @@ class FluidTemplateContentObjectTest extends UnitTestCase */ protected ObjectProphecy $contentObjectRenderer; + /** + * @var ContentDataProcessor + */ + protected ContentDataProcessor $contentDataProcessor; + /** * @var StandaloneView|MockObject */ @@ -77,7 +84,9 @@ class FluidTemplateContentObjectTest extends UnitTestCase protected function setUp(): void { parent::setUp(); + $this->contentDataProcessor = new ContentDataProcessor($this->prophesize(ContainerInterface::class)->reveal()); $this->contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $this->subject = $this->getAccessibleMock( FluidTemplateContentObject::class, ['initializeStandaloneViewInstance'], @@ -109,6 +118,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase public function constructSetsContentObjectRenderer(): void { $contentObjectRenderer = new ContentObjectRenderer(); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer); self::assertEquals($contentObjectRenderer, $subject->getContentObjectRenderer()); } @@ -150,6 +160,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $standAloneView->render(Argument::cetera())->willReturn(''); $standAloneView->renderSection(Argument::cetera())->willReturn(''); GeneralUtility::addInstance(StandaloneView::class, $standAloneView->reveal()); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $subject->render($configuration); @@ -168,6 +179,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('file', $configuration)->willReturn('EXT:core/bar.html'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -197,6 +209,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(7); $contentObjectRenderer->cObjGetSingle('FILE', ['file' => Environment::getPublicPath() . '/foo/bar.html'], 'template')->willReturn('baz'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->assignMultiple(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -225,6 +238,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('templateName', $configuration)->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -258,6 +272,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('templateName', $configuration)->willReturn('bar'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -283,6 +298,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('layoutRootPath', $configuration)->willReturn('foo/bar.html'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -311,6 +327,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -343,6 +360,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrap('FILE', ['file' => 'foo/bar.html'])->shouldBeCalled(); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setLayoutRootPaths(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -387,6 +405,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('layoutRootPath', $configuration)->willReturn('foo/main.html'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -415,6 +434,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('partialRootPath', $configuration)->willReturn('foo/bar.html'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -452,6 +472,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $standAloneView->render(Argument::cetera())->willReturn(''); $standAloneView->renderSection(Argument::cetera())->willReturn(''); GeneralUtility::addInstance(StandaloneView::class, $standAloneView->reveal()); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $subject->render($configuration); @@ -470,6 +491,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase ]; $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -518,6 +540,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $standAloneView->render(Argument::cetera())->willReturn(''); $standAloneView->renderSection(Argument::cetera())->willReturn(''); GeneralUtility::addInstance(StandaloneView::class, $standAloneView->reveal()); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $subject->render($configuration); @@ -544,6 +567,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('format', $configuration)->willReturn('xml'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -569,6 +593,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -597,6 +622,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('pluginName', ['pluginName' => 'foo'])->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -628,6 +654,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -656,6 +683,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('controllerExtensionName', ['controllerExtensionName' => 'foo'])->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -687,6 +715,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -715,6 +744,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('controllerName', ['controllerName' => 'foo'])->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -746,6 +776,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -774,6 +805,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->stdWrapValue('controllerActionName', ['controllerActionName' => 'foo'])->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename('')->shouldBeCalled(); @@ -804,6 +836,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -853,6 +886,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $standAloneView->render(Argument::cetera())->willReturn(''); $standAloneView->renderSection(Argument::cetera())->willReturn(''); GeneralUtility::addInstance(StandaloneView::class, $standAloneView->reveal()); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($this->prophesize(ContentObjectRenderer::class)->reveal()); $subject->render($configuration); @@ -914,6 +948,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); $standAloneView->setTemplatePathAndFilename(Argument::cetera())->willReturn(new ReturnTypeNode('void')); @@ -945,6 +980,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer->stdWrapValue(Argument::cetera())->shouldBeCalledTimes(8); $contentObjectRenderer->cObjGetSingle(Argument::cetera())->willReturn('foo'); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class); @@ -1014,6 +1050,7 @@ class FluidTemplateContentObjectTest extends UnitTestCase $contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class); + GeneralUtility::addInstance(ContentDataProcessor::class, $this->contentDataProcessor); $subject = new FluidTemplateContentObject($contentObjectRenderer->reveal()); $standAloneView = $this->prophesize(StandaloneView::class);