Skip to content

Commit

Permalink
TASK: Fix Fusion e3e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Nov 2, 2023
1 parent f04cefd commit 6e9e6a2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
14 changes: 10 additions & 4 deletions Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*/
trait FusionTrait
{

use RoutingTrait;
use ProjectedNodeTrait;
use CRTestSuiteRuntimeVariables;
Expand All @@ -49,6 +48,14 @@ trait FusionTrait

private ?\Throwable $lastRenderingException = null;

/**
* @template T of object
* @param class-string<T> $className
*
* @return T
*/
abstract private function getObject(string $className): object;

/**
* @BeforeScenario
*/
Expand Down Expand Up @@ -94,7 +101,7 @@ public function theFusionContextNodeIs(string $nodeAggregateId): void
*/
public function theFusionContextRequestIs(string $requestUri = null): void
{
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', $requestUri);
$httpRequest = $this->getObject(ServerRequestFactoryInterface::class)->createServerRequest('GET', $requestUri);
$httpRequest = $this->addRoutingParameters($httpRequest);

$this->fusionGlobalContext['request'] = ActionRequest::fromHttpRequest($httpRequest);
Expand All @@ -108,7 +115,6 @@ public function iHaveTheFollowingFusionSetup(PyStringNode $fusionCode): void
$this->fusionCode = $fusionCode->getRaw();
}


/**
* @When I execute the following Fusion code:
* @When I execute the following Fusion code on path :path:
Expand All @@ -126,7 +132,7 @@ public function iExecuteTheFollowingFusionCode(PyStringNode $fusionCode, string
$fusionGlobals = FusionGlobals::fromArray($this->fusionGlobalContext);

$fusionRuntime = (new RuntimeFactory())->createFromConfiguration($fusionAst, $fusionGlobals);
$fusionRuntime->overrideExceptionHandler($this->getObjectManager()->get(ThrowingHandler::class));
$fusionRuntime->overrideExceptionHandler($this->getObject(ThrowingHandler::class));
$fusionRuntime->pushContextArray($this->fusionContext);
try {
$this->renderingResult = $fusionRuntime->render($path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@fixtures
@flowEntities
Feature: Tests for the "Neos.Neos:ContentCase" Fusion prototype

Background:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@fixtures
@flowEntities
Feature: Tests for the "Neos.Neos:ContentCollection" Fusion prototype

Background:
Expand Down Expand Up @@ -72,13 +72,11 @@ Feature: Tests for the "Neos.Neos:ContentCollection" Fusion prototype
include: resource://Neos.Fusion/Private/Fusion/Root.fusion
include: resource://Neos.Neos/Private/Fusion/Root.fusion
test = Neos.Neos:ContentCollection {
@exceptionHandler = 'Neos\\Fusion\\Core\\ExceptionHandlers\\ThrowingHandler'
}
test = Neos.Neos:ContentCollection
"""
Then I expect the following Fusion rendering error:
"""
No content collection of type Neos.Neos:ContentCollection could be found in the current node (/sites/a) or at the path "to-be-set-by-user". You might want to adjust your node type configuration and create the missing child node through the "./flow node:repair --node-type Neos.Neos:Test.DocumentType" command.
No content collection of type Neos.Neos:ContentCollection could be found in the current node (/[root]) or at the path "to-be-set-by-user". You might want to adjust your node type configuration and create the missing child node through the "flow structureadjustments:fix --node-type Neos.Neos:Site" command.
"""

Scenario: invalid nodePath
Expand All @@ -89,12 +87,11 @@ Feature: Tests for the "Neos.Neos:ContentCollection" Fusion prototype
test = Neos.Neos:ContentCollection {
nodePath = 'invalid'
@exceptionHandler = 'Neos\\Fusion\\Core\\ExceptionHandlers\\ThrowingHandler'
}
"""
Then I expect the following Fusion rendering error:
"""
No content collection of type Neos.Neos:ContentCollection could be found in the current node (/sites/a) or at the path "invalid". You might want to adjust your node type configuration and create the missing child node through the "./flow node:repair --node-type Neos.Neos:Test.DocumentType" command.
No content collection of type Neos.Neos:ContentCollection could be found in the current node (/[root]) or at the path "invalid". You might want to adjust your node type configuration and create the missing child node through the "flow structureadjustments:fix --node-type Neos.Neos:Site" command.
"""

Scenario: empty ContentCollection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@fixtures
@flowEntities
Feature: Tests for the "Neos.Neos:ConvertUris" Fusion prototype

Background:
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Tests/Behavior/Features/Fusion/Menu.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@fixtures @contentrepository
@flowEntities @contentrepository
Feature: Tests for the "Neos.Neos:Menu" and related Fusion prototypes

Background:
Expand Down

0 comments on commit 6e9e6a2

Please sign in to comment.