diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminator.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminator.php index 005e5464e4d..043282d1e0d 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminator.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminator.php @@ -14,6 +14,7 @@ namespace Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\Helpers; +use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; @@ -47,10 +48,12 @@ public static function fromShorthand(string $shorthand): self ); } - public static function fromNode(Node $node): self + public static function fromNode(Node $node, ContentRepository $contentRepository): self { + // todo call ContentGraphFinder::forgetInstances ??? + $contentStreamOfNode = $contentRepository->getContentGraph($node->workspaceName)->getContentStreamId(); return new self( - $node->subgraphIdentity->contentStreamId, + $contentStreamOfNode, $node->aggregateId, $node->originDimensionSpacePoint ); diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminators.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminators.php index 2bedcbce70e..07924d1de4a 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminators.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/Helpers/NodeDiscriminators.php @@ -53,14 +53,6 @@ public static function fromArray(array $array): self )); } - public static function fromNodes(Nodes $nodes): self - { - return new self(...array_map( - fn (Node $node): NodeDiscriminator => NodeDiscriminator::fromNode($node), - iterator_to_array($nodes) - )); - } - public function equal(self $other): bool { return $this->discriminators == $other->discriminators; diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/ProjectedNodeTrait.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/ProjectedNodeTrait.php index b227c5660b6..f89d3015040 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/ProjectedNodeTrait.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/ProjectedNodeTrait.php @@ -110,7 +110,7 @@ public function iExpectNodeAggregateIdToLeadToNode( $this->initializeCurrentNodeFromContentSubgraph(function (ContentSubgraphInterface $subgraph) use ($nodeAggregateId, $expectedDiscriminator) { $currentNode = $subgraph->findNodeById($nodeAggregateId); Assert::assertNotNull($currentNode, 'No node could be found by node aggregate id "' . $nodeAggregateId->value . '" in content subgraph "' . $this->currentDimensionSpacePoint->toJson() . '@' . $this->currentWorkspaceName->value . '"'); - $actualDiscriminator = NodeDiscriminator::fromNode($currentNode); + $actualDiscriminator = NodeDiscriminator::fromNode($currentNode, $this->currentContentRepository); Assert::assertTrue($expectedDiscriminator->equals($actualDiscriminator), 'Node discriminators do not match. Expected was ' . json_encode($expectedDiscriminator) . ' , given was ' . json_encode($actualDiscriminator)); return $currentNode; }); @@ -147,7 +147,7 @@ public function iExpectPathToLeadToNode(string $serializedNodePath, string $seri $this->initializeCurrentNodeFromContentSubgraph(function (ContentSubgraphInterface $subgraph) use ($nodePath, $expectedDiscriminator) { $currentNode = $subgraph->findNodeByPath($nodePath, $this->getRootNodeAggregateId()); Assert::assertNotNull($currentNode, 'No node could be found by node path "' . $nodePath->serializeToString() . '" in content subgraph "' . $this->currentDimensionSpacePoint->toJson() . '@' . $this->currentWorkspaceName->value . '"'); - $actualDiscriminator = NodeDiscriminator::fromNode($currentNode); + $actualDiscriminator = NodeDiscriminator::fromNode($currentNode, $this->currentContentRepository); Assert::assertTrue($expectedDiscriminator->equals($actualDiscriminator), 'Node discriminators do not match. Expected was ' . json_encode($expectedDiscriminator) . ' , given was ' . json_encode($actualDiscriminator)); return $currentNode; }); @@ -479,7 +479,7 @@ private function assertReferencesMatch(TableNode $expectedReferencesTable, Refer $actualReferences[$index]->name->value ); $expectedReferenceDiscriminator = NodeDiscriminator::fromShorthand($row['Node']); - $actualReferenceDiscriminator = NodeDiscriminator::fromNode($actualReferences[$index]->node); + $actualReferenceDiscriminator = NodeDiscriminator::fromNode($actualReferences[$index]->node, $this->currentContentRepository); Assert::assertTrue( $expectedReferenceDiscriminator->equals($actualReferenceDiscriminator), 'Reference discriminator does not match.' @@ -553,12 +553,12 @@ public function iExpectThisNodeToBeTheChildOfNode(string $serializedParentNodeDi $parent = $subgraph->findParentNode($currentNode->aggregateId); Assert::assertInstanceOf(Node::class, $parent, 'Parent not found.'); - $actualParentDiscriminator = NodeDiscriminator::fromNode($parent); + $actualParentDiscriminator = NodeDiscriminator::fromNode($parent, $this->currentContentRepository); Assert::assertTrue($expectedParentDiscriminator->equals($actualParentDiscriminator), 'Parent discriminator does not match. Expected was ' . json_encode($expectedParentDiscriminator) . ', given was ' . json_encode($actualParentDiscriminator)); - $expectedChildDiscriminator = NodeDiscriminator::fromNode($currentNode); + $expectedChildDiscriminator = NodeDiscriminator::fromNode($currentNode, $this->currentContentRepository); $child = $subgraph->findNodeByPath($currentNode->name, $parent->aggregateId); - $actualChildDiscriminator = NodeDiscriminator::fromNode($child); + $actualChildDiscriminator = NodeDiscriminator::fromNode($child, $this->currentContentRepository); Assert::assertTrue($expectedChildDiscriminator->equals($actualChildDiscriminator), 'Child discriminator does not match. Expected was ' . json_encode($expectedChildDiscriminator) . ', given was ' . json_encode($actualChildDiscriminator)); }); } @@ -596,7 +596,10 @@ public function iExpectThisNodeToHaveTheFollowingChildNodes(TableNode $expectedC Assert::assertTrue($expectedNodeName->equals($actualNodeName), 'ContentSubgraph::findChildNodes: Node name in index ' . $index . ' does not match. Expected: "' . $expectedNodeName->value . '" Actual: "' . $actualNodeName->value . '"'); if (isset($row['NodeDiscriminator'])) { $expectedNodeDiscriminator = NodeDiscriminator::fromShorthand($row['NodeDiscriminator']); - $actualNodeDiscriminator = NodeDiscriminator::fromNode($actualChildNodes[$index]); + $actualNodeDiscriminator = NodeDiscriminator::fromNode( + $actualChildNodes[$index], + $this->currentContentRepository + ); Assert::assertTrue($expectedNodeDiscriminator->equals($actualNodeDiscriminator), 'ContentSubgraph::findChildNodes: Node discriminator in index ' . $index . ' does not match. Expected: ' . json_encode($expectedNodeDiscriminator->jsonSerialize()) . ' Actual: ' . json_encode($actualNodeDiscriminator)); } } @@ -635,7 +638,10 @@ public function iExpectThisNodeToHaveTheFollowingPrecedingSiblings(TableNode $ex Assert::assertCount(count($expectedPrecedingSiblingsTable->getHash()), $actualSiblings, 'ContentSubgraph::findPrecedingSiblingNodes: Sibling count does not match'); foreach ($expectedPrecedingSiblingsTable->getHash() as $index => $row) { $expectedNodeDiscriminator = NodeDiscriminator::fromShorthand($row['NodeDiscriminator']); - $actualNodeDiscriminator = NodeDiscriminator::fromNode($actualSiblings[$index]); + $actualNodeDiscriminator = NodeDiscriminator::fromNode( + $actualSiblings[$index], + $this->currentContentRepository + ); Assert::assertTrue($expectedNodeDiscriminator->equals($actualNodeDiscriminator), 'ContentSubgraph::findPrecedingSiblingNodes: Node discriminator in index ' . $index . ' does not match. Expected: ' . json_encode($expectedNodeDiscriminator) . ' Actual: ' . json_encode($actualNodeDiscriminator)); } }); @@ -672,7 +678,10 @@ public function iExpectThisNodeToHaveTheFollowingSucceedingSiblings(TableNode $e Assert::assertCount(count($expectedSucceedingSiblingsTable->getHash()), $actualSiblings, 'ContentSubgraph::findSucceedingSiblingNodes: Sibling count does not match'); foreach ($expectedSucceedingSiblingsTable->getHash() as $index => $row) { $expectedNodeDiscriminator = NodeDiscriminator::fromShorthand($row['NodeDiscriminator']); - $actualNodeDiscriminator = NodeDiscriminator::fromNode($actualSiblings[$index]); + $actualNodeDiscriminator = NodeDiscriminator::fromNode( + $actualSiblings[$index], + $this->currentContentRepository + ); Assert::assertTrue($expectedNodeDiscriminator->equals($actualNodeDiscriminator), 'ContentSubgraph::findSucceedingSiblingNodes: Node discriminator in index ' . $index . ' does not match. Expected: ' . json_encode($expectedNodeDiscriminator) . ' Actual: ' . json_encode($actualNodeDiscriminator)); } });