Skip to content

Commit

Permalink
MERGE: Merge branch '8.0' into 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kdambekalns committed Sep 12, 2022
2 parents 62bd12a + 4f570db commit 60d12f8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Classes/Core/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,8 @@ protected function evaluateApplyValues($configurationWithEventualProperties, $fu
$singleApplyPath .= '/expression';
}
$singleApplyValues = $this->evaluate($singleApplyPath, null, self::BEHAVIOR_EXCEPTION);
if ($this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
if ($singleApplyValues === null) {
continue;
} elseif (is_array($singleApplyValues)) {
if ($singleApplyValues !== null || $this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
if (is_array($singleApplyValues)) {
foreach ($singleApplyValues as $key => $value) {
// skip keys which start with __, as they are purely internal.
if ($key[0] === '_' && $key[1] === '_' && in_array($key, Parser::$reservedParseTreeKeys, true)) {
Expand Down Expand Up @@ -837,7 +835,7 @@ protected function evaluateProcessors($valueToProcess, $configurationWithEventua

$this->pushContext('value', $valueToProcess);
$result = $this->evaluate($processorPath, $contextObject, self::BEHAVIOR_EXCEPTION);
if ($this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
if ($result !== null || $this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
$valueToProcess = $result;
}
$this->popContext();
Expand Down
10 changes: 10 additions & 0 deletions Tests/Functional/FusionObjects/ApplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,14 @@ public function rendererWithNestedPropsInApply()
$view->setFusionPath('apply/renderWithNestedProps');
self::assertEquals('::example::', $view->render());
}

/**
* @test
*/
public function evaluateLazyPropsWithLastOneSkipped()
{
$view = $this->buildView();
$view->setFusionPath('apply/evaluateLazyPropsWithLastOneSkipped');
self::assertSame(['lazyPropValue' => 'foo'], $view->render());
}
}
12 changes: 12 additions & 0 deletions Tests/Functional/FusionObjects/Fixtures/Fusion/Apply.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,15 @@ prototype(Neos.Fusion:TestNestedPropsB) < prototype(Neos.Fusion:Component) {
item_2 = '::'
}
}

// https://github.com/neos/neos-development-collection/issues/3469
apply.evaluateLazyPropsWithLastOneSkipped = Neos.Fusion:Component {
lazyPropValue = "foo"

lazyPropSkipped = "skip"
[email protected] = false

renderer = Neos.Fusion:DataStructure {
@apply.forceEvaluatedProps = ${Array.filter(props, prop => prop != null)}
}
}
13 changes: 13 additions & 0 deletions Tests/Functional/FusionObjects/Fixtures/Fusion/Processor.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,16 @@ processors.newSyntax.usingThisInProcessor = Neos.Fusion:Value {
@process.1 = ${value + this.append}
append = " append"
}

// https://github.com/neos/neos-development-collection/issues/3469
processors.newSyntax.skippedLazyPropsInProcessor = Neos.Fusion:Component {
lazyPropValue = "foo"

lazyPropSkipped = "skip"
[email protected] = false

renderer = Neos.Fusion:DataStructure {
buz = "bar"
@process.combine = ${Array.concat(value, Array.filter(props, prop => prop != null))}
}
}
10 changes: 10 additions & 0 deletions Tests/Functional/FusionObjects/ProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,14 @@ public function usingThisInProcessorWorks()
{
$this->assertFusionPath('my value append', 'processors/newSyntax/usingThisInProcessor');
}

/**
* @test
*/
public function skippedLazyPropsInProcessor()
{
$view = $this->buildView();
$view->setFusionPath('processors/newSyntax/skippedLazyPropsInProcessor');
self::assertSame(['buz' => 'bar', 'lazyPropValue' => 'foo'], $view->render());
}
}

0 comments on commit 60d12f8

Please sign in to comment.