From 7bba496efbc9361486638387e96ae7b32481ebcc Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 27 Jul 2024 09:07:55 +0200 Subject: [PATCH] TASK: Add tests for autocreated childnode labels --- .../Configuration/Testing/NodeTypes.yaml | 10 ++++++++++ .../Tests/Functional/Domain/NodesTest.php | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Neos.ContentRepository/Configuration/Testing/NodeTypes.yaml b/Neos.ContentRepository/Configuration/Testing/NodeTypes.yaml index 56362f49579..28a7aafda62 100644 --- a/Neos.ContentRepository/Configuration/Testing/NodeTypes.yaml +++ b/Neos.ContentRepository/Configuration/Testing/NodeTypes.yaml @@ -205,3 +205,13 @@ 'Neos.ContentRepository.Testing:NodeTypeWithEelExpressionLabel': label: '${"Test" + " " + "nodetype"}' + +'Neos.ContentRepository.Testing:NodeTypeWithPlainLabelInChildNode': + childNodes: + child: + label: 'Test child node' + +'Neos.ContentRepository.Testing:NodeTypeWithEelExpressionLabelInChildNode': + childNodes: + child: + label: '${"Test" + " child " + "node"}' diff --git a/Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php b/Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php index 8c7d3288e85..e173472a921 100644 --- a/Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php +++ b/Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php @@ -1077,6 +1077,23 @@ public function getLabelReturnsParsedEelExpressionOrFallback() self::assertEquals('Test nodetype', $nodeWithEelExpressionLabel->getLabel()); } + /** + * @test + */ + public function getChildNodeLabelReturnsParsedEelExpressionOrFallback() + { + $nodeTypeManager = $this->objectManager->get(NodeTypeManager::class); + $nodeTypeWithPlainLabelInChildNode = $nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeTypeWithPlainLabelInChildNode'); + $nodeTypeWithEelExpressionLabelInChildNode = $nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeTypeWithEelExpressionLabelInChildNode'); + + $rootNode = $this->context->getNode('/'); + $nodeWithPlainLabelInChildNode = $rootNode->createNode('node-plain', $nodeTypeWithPlainLabelInChildNode, '30e893c1-caef-0ca5-b53d-e5699bb8e506'); + $nodeWithEelExpressionLabelInChildNode = $rootNode->createNode('node-eel', $nodeTypeWithEelExpressionLabelInChildNode, '81c848ed-abb5-7608-a5db-7eea0331ccfa'); + + self::assertEquals('Test child node', $nodeWithPlainLabelInChildNode->getLabel()); + self::assertEquals('Test child node', $nodeWithEelExpressionLabelInChildNode->getLabel()); + } + /** * @test */