Skip to content

Commit

Permalink
BUGFIX: Add condition for properties
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellienert committed Mar 5, 2020
1 parent 9ed61ff commit 0226c5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Configuration/Testing/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ PunktDe:
# title node which should be considered to move the page.
'PunktDe.Archivist.TriggerContentNode':

condition: "${node.properties.title != null}"

# The query selecting the root node of the automatically created hierarchy
hierarchyRoot: "${q(site).find('[instanceof Neos.ContentRepository.Testing:Page]').get(0)}"

Expand Down
20 changes: 10 additions & 10 deletions Tests/Functional/ArchivistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function setUp(): void
/**
* @test
*/
public function nodeStructureIsAvailable()
public function nodeStructureIsAvailable(): void
{
$this->assertEquals('Neos.ContentRepository.Testing:Page', $this->node->getNodeType()->getName());
}
Expand All @@ -47,7 +47,7 @@ public function nodeStructureIsAvailable()
* @test
* @throws NodeTypeNotFoundException
*/
public function simpleCreateNode()
public function simpleCreateNode(): void
{
$newNode = $this->createNode('trigger-node', ['title' => 'New Article', 'date' => new DateTime('2018-01-19')]);

Expand All @@ -71,7 +71,7 @@ public function simpleCreateNode()
* @test
* @throws NodeTypeNotFoundException
*/
public function doNotSortWhenConditionIsNotMet()
public function doNotSortWhenConditionIsNotMet(): void
{
$triggerNode = $this->createNode('trigger-node', ['title' => 'New Article']);
$this->assertCount(0, $this->node->getChildNodes('PunktDe.Archivist.HierarchyNode'));
Expand Down Expand Up @@ -142,7 +142,7 @@ public function hierarchyNodesAreSortedCorrectlyWithEelExpression()
* @throws NodeTypeNotFoundException
* @throws Exception
*/
public function createdNodesAreSortedCorrectly()
public function createdNodesAreSortedCorrectly(): void
{
$this->createNode('trigger-node2', ['title' => 'Node 2', 'date' => new DateTime('2018-01-19')]);
$this->createNode('trigger-node1', ['title' => 'Node 1', 'date' => new DateTime('2018-01-19')]);
Expand All @@ -159,7 +159,7 @@ public function createdNodesAreSortedCorrectly()
* @throws NodeTypeNotFoundException
* @throws Exception
*/
public function nodesAreSortedIfHierarchyAlreadyExist()
public function nodesAreSortedIfHierarchyAlreadyExist(): void
{
$triggerNode2 = $this->createNode('trigger-node2', ['title' => 'Node 2', 'date' => new DateTime('2018-01-19')]);
$triggerNode1 = $this->createNode('trigger-node1', ['title' => 'Node 1', 'date' => new DateTime('2018-01-19')]);
Expand All @@ -184,7 +184,7 @@ public function nodesAreSortedIfHierarchyAlreadyExist()
* @throws NodeExistsException
* @throws NodeTypeNotFoundException
*/
public function documentNodeIsSortedByTriggeringContentNode()
public function documentNodeIsSortedByTriggeringContentNode(): void
{
$affectedDocumentNode = $this->createNode('affected-node', ['title' => 'theTitle'], 'Neos.ContentRepository.Testing:Document');
$triggerNode = $affectedDocumentNode->createNode('trigger-node', $this->nodeTypeManager->getNodeType('PunktDe.Archivist.TriggerContentNode'));
Expand All @@ -198,7 +198,7 @@ public function documentNodeIsSortedByTriggeringContentNode()
* @throws NodeExistsException
* @throws NodeTypeNotFoundException
*/
public function documentNodeIsSortedByTriggeringContentNodeAndDocumentIsMovedAfterwards()
public function documentNodeIsSortedByTriggeringContentNodeAndDocumentIsMovedAfterwards(): void
{
$unaffectedNode = $this->createNode('unaffect-node', ['title' => 'an unaffected node'], 'Neos.ContentRepository.Testing:Document');
$affectedDocumentNode = $this->createNode('affected-node', ['title' => 'theTitle'], 'Neos.ContentRepository.Testing:Document');
Expand All @@ -217,7 +217,7 @@ public function documentNodeIsSortedByTriggeringContentNodeAndDocumentIsMovedAft
* @test
* @throws NodeTypeNotFoundException
*/
public function contentNodeIsSortedInDocument()
public function contentNodeIsSortedInDocument(): void
{
$triggerNodeType = $this->nodeTypeManager->getNodeType('PunktDe.Archivist.TriggerContentNodeToBeSortedInDocument');

Expand All @@ -234,7 +234,7 @@ public function contentNodeIsSortedInDocument()
* @test
* @throws NodeTypeNotFoundException
*/
public function minimalExampleIsValid()
public function minimalExampleIsValid(): void
{
$triggerNode = $this->createNode('trigger-node', ['title' => 'New Article'], 'PunktDe.Archivist.MinimalConfiguredTriggerNode');

Expand All @@ -251,7 +251,7 @@ public function minimalExampleIsValid()
* @return NodeInterface
* @throws NodeTypeNotFoundException
*/
protected function createNode($nodeName = 'trigger-node', array $properties = [], $triggerNodeType = 'PunktDe.Archivist.TriggerNode')
protected function createNode($nodeName = 'trigger-node', array $properties = [], $triggerNodeType = 'PunktDe.Archivist.TriggerNode'): NodeInterface
{
$triggerNodeType = $this->nodeTypeManager->getNodeType($triggerNodeType);

Expand Down

0 comments on commit 0226c5a

Please sign in to comment.