Skip to content

Commit

Permalink
Merge branch '9.0' into task/fix-testsuite-for-simple-use-cases
Browse files Browse the repository at this point in the history
# Conflicts:
#	Neos.ContentRepository.BehavioralTests/Configuration/Settings.yaml
#	Neos.ContentRepository.BehavioralTests/Configuration/Testing/Behat/Settings.ContentRepositoryRegistry.yaml
#	Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php
#	Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteRuntimeVariables.php
#	Neos.ContentRepository.TestSuite/Classes/Fakes/FakeUserIdProvider.php
#	Neos.ContentRepository.TestSuite/Classes/Fakes/FakeUserIdProviderFactory.php
  • Loading branch information
kitsunet committed Nov 19, 2024
2 parents 3c20365 + 56d616f commit 4bdc6d7
Show file tree
Hide file tree
Showing 286 changed files with 7,784 additions and 4,427 deletions.
3 changes: 2 additions & 1 deletion .composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepository.Core/Tests/Unit",
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepositoryRegistry/Tests/Unit"
],
"test:paratest-cli": "../../bin/paratest --debug -v --functional --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml",
"test:parallel": [
"FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php"
"for f in Neos.ContentRepository.BehavioralTests/Tests/Parallel/**/*Test.php; do composer test:paratest-cli $f; done"
],
"test:behat-cli": "../../bin/behat -f progress --strict --no-interaction",
"test:behavioral": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\Projection\ContentGraph\References;
use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree;
use Neos\ContentRepository\Core\Projection\ContentGraph\Subtrees;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
Expand Down Expand Up @@ -304,7 +305,11 @@ public function findSubtree(NodeAggregateId $entryNodeAggregateId, FindSubtreeFi
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
$subtree = new Subtree((int)$nodeData['level'], $node, array_key_exists($nodeAggregateId, $subtreesByParentNodeId) ? array_reverse($subtreesByParentNodeId[$nodeAggregateId]) : []);
$subtree = Subtree::create(
(int)$nodeData['level'],
$node,
array_key_exists($nodeAggregateId, $subtreesByParentNodeId) ? Subtrees::fromArray(array_reverse($subtreesByParentNodeId[$nodeAggregateId])) : Subtrees::createEmpty()
);
if ($subtree->level === 0) {
return $subtree;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Reference;
use Neos\ContentRepository\Core\Projection\ContentGraph\References;
use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree;
use Neos\ContentRepository\Core\Projection\ContentGraph\Subtrees;
use Neos\ContentRepository\Core\Projection\ContentGraph\Timestamps;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
Expand Down Expand Up @@ -154,7 +155,11 @@ public function mapNodeRowsToSubtree(
$nodeAggregateId = $nodeRow['nodeaggregateid'];
$parentNodeAggregateId = $nodeRow['parentnodeaggregateid'];
$node = $this->mapNodeRowToNode($nodeRow, $visibilityConstraints);
$subtree = new Subtree((int)$nodeRow['level'], $node, array_key_exists($nodeAggregateId, $subtreesByParentNodeId) ? array_reverse($subtreesByParentNodeId[$nodeAggregateId]) : []);
$subtree = Subtree::create(
(int)$nodeRow['level'],
$node,
array_key_exists($nodeAggregateId, $subtreesByParentNodeId) ? Subtrees::fromArray(array_reverse($subtreesByParentNodeId[$nodeAggregateId])) : Subtrees::createEmpty()
);
if ($subtree->level === 0) {
return $subtree;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Neos:
factoryObjectName: Neos\ContentRepository\TestSuite\Fakes\FakeNodeTypeManagerFactory
contentDimensionSource:
factoryObjectName: Neos\ContentRepository\TestSuite\Fakes\FakeContentDimensionSourceFactory
userIdProvider:
factoryObjectName: Neos\ContentRepositoryRegistry\Factory\UserIdProvider\StaticUserIdProviderFactory
authProvider:
factoryObjectName: Neos\ContentRepository\TestSuite\Fakes\FakeAuthProviderFactory
clock:
factoryObjectName: Neos\ContentRepositoryRegistry\Factory\Clock\SystemClockFactory
propertyConverters: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Neos:
ContentRepositoryRegistry:
presets:
default:
userIdProvider:
factoryObjectName: 'Neos\ContentRepository\TestSuite\Fakes\FakeUserIdProviderFactory'
authProvider:
factoryObjectName: Neos\ContentRepository\TestSuite\Fakes\FakeAuthProviderFactory
clock:
factoryObjectName: 'Neos\ContentRepository\TestSuite\Fakes\FakeClockFactory'
nodeTypeManager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ Feature: Create node aggregate with node
And using identifier "default", I define a content repository
And I am in content repository "default"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| newContentStreamId | "cs-identifier" |
| Key | Value |
| workspaceName | "live" |
| newContentStreamId | "cs-identifier" |
And I am in workspace "live"
And I am in dimension space point {}
And I am user identified by "initiating-user-identifier"
Expand All @@ -202,14 +202,14 @@ Feature: Create node aggregate with node
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |

Given the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
Given the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:NodeWithoutTetheredChildNodes" |
| originDimensionSpacePoint | {} |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "node" |
And the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
And the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-nodeward-nodington-iii" |
| nodeTypeName | "Neos.ContentRepository.Testing:NodeWithoutTetheredChildNodes" |
Expand Down Expand Up @@ -280,7 +280,7 @@ Feature: Create node aggregate with node
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |

When the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:NodeWithTetheredChildNodes" |
Expand Down Expand Up @@ -459,7 +459,7 @@ Feature: Create node aggregate with node
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |

When the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:NodeWithTetheredChildNodes" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Feature: Constraint checks on node aggregate disabling
| nodeAggregateId | "i-do-not-exist" |
| nodeVariantSelectionStrategy | "allVariants" |
| tag | "disabled" |
Then the last command should have thrown an exception of type "NodeAggregateCurrentlyDoesNotExist"

Scenario: Try to disable an already disabled node aggregate
Given the command DisableNodeAggregate is executed with payload:
Expand All @@ -61,19 +62,12 @@ Feature: Constraint checks on node aggregate disabling
| coveredDimensionSpacePoint | {"language": "de"} |
| nodeVariantSelectionStrategy | "allVariants" |

# Note: The behavior has been changed with https://github.com/neos/neos-development-collection/pull/4284 and the test was adjusted accordingly
When the command DisableNodeAggregate is executed with payload:
When the command DisableNodeAggregate is executed with payload and exceptions are caught:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| coveredDimensionSpacePoint | {"language": "de"} |
| nodeVariantSelectionStrategy | "allVariants" |
Then I expect exactly 4 events to be published on stream with prefix "ContentStream:cs-identifier"
And event at index 3 is of type "SubtreeWasTagged" with payload:
| Key | Expected |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "sir-david-nodenborough" |
| affectedDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| tag | "disabled" |
Then the last command should have thrown an exception of type "NodeAggregateIsAlreadyDisabled"


Scenario: Try to disable a node aggregate in a non-existing dimension space point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Feature: Disable a node aggregate
And I expect node aggregate identifier "nody-mc-nodeface" and node path "document/child-document" to lead to node cs-identifier;nody-mc-nodeface;{}
And I expect this node to be a child of node cs-identifier;sir-david-nodenborough;{}

When VisibilityConstraints are set to "frontend"
When VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Feature: Disable a node aggregate
And I expect node aggregate identifier "nody-mc-nodeface" and node path "document/child-document" to lead to node cs-identifier;nody-mc-nodeface;{"language":"mul"}
And I expect this node to be a child of node cs-identifier;sir-david-nodenborough;{"language":"mul"}

When VisibilityConstraints are set to "frontend"
When VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -148,7 +148,7 @@ Feature: Disable a node aggregate

# Tests for the generalization
When I am in dimension space point {"language":"mul"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -195,7 +195,7 @@ Feature: Disable a node aggregate

# Tests for the virtual specialization
When I am in dimension space point {"language":"gsw"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -224,7 +224,7 @@ Feature: Disable a node aggregate

# Tests for the real specialization
When I am in dimension space point {"language":"ltz"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -253,7 +253,7 @@ Feature: Disable a node aggregate

# Tests for the peer variant
When I am in dimension space point {"language":"en"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -371,7 +371,7 @@ Feature: Disable a node aggregate
And I expect node aggregate identifier "nody-mc-nodeface" and node path "document/child-document" to lead to node cs-identifier;nody-mc-nodeface;{"language":"mul"}
And I expect this node to be a child of node cs-identifier;sir-david-nodenborough;{"language":"mul"}

When VisibilityConstraints are set to "frontend"
When VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -399,7 +399,7 @@ Feature: Disable a node aggregate

# Tests for the generalization
When I am in dimension space point {"language":"mul"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -428,7 +428,7 @@ Feature: Disable a node aggregate

# Tests for the virtual specialization
When I am in dimension space point {"language":"gsw"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -457,7 +457,7 @@ Feature: Disable a node aggregate

# Tests for the real specialization
When I am in dimension space point {"language":"ltz"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -486,7 +486,7 @@ Feature: Disable a node aggregate

# Tests for the peer variant
When I am in dimension space point {"language":"en"}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ Feature: Enable a node aggregate
| nodeVariantSelectionStrategy | "allVariants" |
Then the last command should have thrown an exception of type "NodeAggregateCurrentlyDoesNotExist"

# Note: The behavior has been changed with https://github.com/neos/neos-development-collection/pull/4284 and the test was adjusted accordingly
Scenario: Try to enable an already enabled node aggregate
When the command EnableNodeAggregate is executed with payload:
When the command EnableNodeAggregate is executed with payload and exceptions are caught:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeVariantSelectionStrategy | "allVariants" |
Then I expect exactly 3 events to be published on stream with prefix "ContentStream:cs-identifier"
Then the last command should have thrown an exception of type "NodeAggregateIsAlreadyEnabled"

Scenario: Try to enable a node aggregate in a non-existing dimension space point
When the command EnableNodeAggregate is executed with payload and exceptions are caught:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Feature: Enable a node aggregate
And I expect this node aggregate to disable dimension space points []

When I am in workspace "live" and dimension space point {}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -143,7 +143,7 @@ Feature: Enable a node aggregate
And I expect this node aggregate to disable dimension space points [{}]

When I am in workspace "live" and dimension space point {}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down Expand Up @@ -218,7 +218,7 @@ Feature: Enable a node aggregate
And I expect this node aggregate to disable dimension space points []

When I am in workspace "live" and dimension space point {}
And VisibilityConstraints are set to "frontend"
And VisibilityConstraints are set to "default"
Then I expect node aggregate identifier "lady-eleonode-rootford" to lead to node cs-identifier;lady-eleonode-rootford;{}
And I expect this node to have the following child nodes:
| Name | NodeDiscriminator |
Expand Down
Loading

0 comments on commit 4bdc6d7

Please sign in to comment.