Skip to content

Commit

Permalink
TASK: Add tests for autocreated childnode labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Jul 27, 2024
1 parent 2e7c49e commit 7bba496
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Neos.ContentRepository/Configuration/Testing/NodeTypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}'
17 changes: 17 additions & 0 deletions Neos.ContentRepository/Tests/Functional/Domain/NodesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 7bba496

Please sign in to comment.