-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5033 from neos/task/3859-datastructure-tests
BUGFIX: Fix handling of unset/nulled DataStructure keys
- Loading branch information
Showing
4 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
Neos.Neos/Tests/Behavior/Features/Fusion/DataStructure.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
@fixtures | ||
Feature: Tests for the "Neos.Fusion:DataStructure" Fusion prototype | ||
|
||
Background: | ||
Given I have the following Fusion setup: | ||
"""fusion | ||
include: resource://Neos.Fusion/Private/Fusion/Root.fusion | ||
include: resource://Neos.Neos/Private/Fusion/Root.fusion | ||
prototype(Neos.Neos:Test.DataStructure.Example) < prototype(Neos.Fusion:DataStructure) { | ||
foo = 'string' | ||
bar { | ||
baz = true | ||
foos { | ||
bars = 123 | ||
removed > | ||
null1 = null | ||
null2 = ${null} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
Scenario: DataStructure (default) | ||
When I execute the following Fusion code: | ||
"""fusion | ||
test = Neos.Neos:Test.DataStructure.Example { | ||
@process.toJson = ${Json.stringify(value)} | ||
} | ||
""" | ||
Then I expect the following Fusion rendering result: | ||
""" | ||
{"foo":"string","bar":{"baz":true,"foos":{"bars":123,"null2":null}}} | ||
""" | ||
|
||
Scenario: DataStructure (with nulled keys) | ||
When I execute the following Fusion code: | ||
"""fusion | ||
test = Neos.Neos:Test.DataStructure.Example { | ||
added = 123.45 | ||
bar.foos > | ||
@process.toJson = ${Json.stringify(value)} | ||
} | ||
""" | ||
Then I expect the following Fusion rendering result: | ||
""" | ||
{"foo":"string","bar":{"baz":true},"added":123.45} | ||
""" | ||
|
||
Scenario: DataStructure (with removed keys) | ||
When I execute the following Fusion code: | ||
"""fusion | ||
test = Neos.Neos:Test.DataStructure.Example { | ||
added = 123.45 | ||
bar.foos > | ||
@process.toJson = ${Json.stringify(value)} | ||
} | ||
""" | ||
Then I expect the following Fusion rendering result: | ||
""" | ||
{"foo":"string","bar":{"baz":true},"added":123.45} | ||
""" | ||
|
||
# @see https://github.com/neos/neos-development-collection/issues/3859 | ||
Scenario: DataStructure (applied null keys) | ||
When I execute the following Fusion code: | ||
"""fusion | ||
test = Neos.Fusion:DataStructure { | ||
@apply.attributes = ${{ | ||
nullAttribute: null | ||
}} | ||
@process.toJson = ${Json.stringify(value)} | ||
} | ||
""" | ||
Then I expect the following Fusion rendering result: | ||
""" | ||
{"nullAttribute":null} | ||
""" |