Skip to content

Commit

Permalink
Merge pull request #4743 from mhsdesign/task/fusionBehatTestMakeSureT…
Browse files Browse the repository at this point in the history
…oThrowRuntimeExceptions

TASK: Fusion Behat Test Make Sure To Throw Runtime Exceptions
  • Loading branch information
mhsdesign committed Nov 19, 2023
2 parents cd0972b + bee5f12 commit 1429260
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion Neos.Neos/Tests/Behavior/Features/Bootstrap/FusionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ public function iExecuteTheFollowingFusionCode(PyStringNode $fusionCode, string
self::$bootstrap->setActiveRequestHandler($requestHandler);
$this->throwExceptionIfLastRenderingLedToAnError();
$this->renderingResult = null;
$fusionAst = (new Parser())->parseFromSource(FusionSourceCodeCollection::fromString($this->fusionCode . chr(10) . $fusionCode->getRaw()));
$fusionAst = (new Parser())->parseFromSource(FusionSourceCodeCollection::fromString($this->fusionCode . chr(10) . $fusionCode->getRaw())->union(
// make sure all exceptions are thrown. Not needed with Neos 9
FusionSourceCodeCollection::fromString(<<<FUSION
$path {
@exceptionHandler = 'Neos\\\\Fusion\\\\Core\\\\ExceptionHandlers\\\\ThrowingHandler'
}
FUSION)
));
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($this->fusionRequest);
$controllerContext = new ControllerContext($this->fusionRequest, new ActionResponse(), new Arguments(), $uriBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ 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:
"""
Expand All @@ -50,7 +48,6 @@ 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:
Expand Down

0 comments on commit 1429260

Please sign in to comment.