From f9611e30bcd68a3f5e9306748abc90968b1d2053 Mon Sep 17 00:00:00 2001 From: Eric Kloss Date: Thu, 25 May 2023 17:11:29 +0200 Subject: [PATCH] make FusionServiceForTesting compatible to Neos 8.3 --- Classes/FusionServiceForTesting.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Classes/FusionServiceForTesting.php b/Classes/FusionServiceForTesting.php index 5fb0f8d..369b01d 100644 --- a/Classes/FusionServiceForTesting.php +++ b/Classes/FusionServiceForTesting.php @@ -3,6 +3,7 @@ namespace Sandstorm\E2ETestTools; use Neos\Flow\Annotations as Flow; +use Neos\Fusion\Core\FusionSourceCodeCollection; use Neos\Neos\Domain\Service\FusionService; use Sandstorm\E2ETestTools\Tests\Behavior\Bootstrap\FusionRenderingTrait; @@ -21,17 +22,18 @@ class FusionServiceForTesting extends FusionService public function getMergedFusionObjectTreeForPackage(string $siteResourcesPackageKey, string $extraFusionCode) { $siteRootFusionPathAndFilename = sprintf($this->siteRootFusionPattern, $siteResourcesPackageKey); - $siteRootFusionCode = $this->readExternalFusionFile($siteRootFusionPathAndFilename); - $mergedFusionCode = ''; - $mergedFusionCode .= $this->generateNodeTypeDefinitions(); - $mergedFusionCode .= $this->getFusionIncludes($this->prepareAutoIncludeFusion()); - $mergedFusionCode .= $this->getFusionIncludes($this->prependFusionIncludes); - $mergedFusionCode .= $siteRootFusionCode; - $mergedFusionCode .= $this->getFusionIncludes($this->appendFusionIncludes); - - $mergedFusionCode .= $extraFusionCode; - - return $this->fusionParser->parse($mergedFusionCode, $siteRootFusionPathAndFilename); + return $this->fusionParser->parseFromSource( + $this->fusionSourceCodeFactory->createFromNodeTypeDefinitions() + ->union( + $this->fusionSourceCodeFactory->createFromAutoIncludes() + ) + ->union( + FusionSourceCodeCollection::tryFromFilePath($siteRootFusionPathAndFilename) + ) + ->union( + FusionSourceCodeCollection::fromString($extraFusionCode) + ) + ); } }