From 433f3698d0c66499666f9a31fdd60d63e6f38c04 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:33:10 +0200 Subject: [PATCH] TASK: Remove further occurrences of `I am in content stream` where they are obsolete --- .../Migration/MoveDimensionSpacePoint.feature | 4 ++- .../04-AllFeaturePublication.feature | 7 ++-- .../Workspaces/PruneContentStreams.feature | 8 +++-- .../Features/Bootstrap/CRTestSuiteTrait.php | 35 +++++++++---------- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/EventSourced/Migration/MoveDimensionSpacePoint.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/EventSourced/Migration/MoveDimensionSpacePoint.feature index 90bf3b31b01..0212ec78c76 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/EventSourced/Migration/MoveDimensionSpacePoint.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/EventSourced/Migration/MoveDimensionSpacePoint.feature @@ -67,13 +67,15 @@ Feature: Move dimension space point to: { language: 'de_DE' } """ # the original content stream has not been touched - When I am in content stream "cs-identifier" and dimension space point {"language": "de"} + When I am in workspace "live" and dimension space point {"language": "de"} + Then I expect the workspace to point to content stream "cs-identifier" Then I expect a node identified by cs-identifier;sir-david-nodenborough;{"language": "de"} to exist in the content graph And I expect this node to be of type "Neos.ContentRepository.Testing:Document" # we find the node underneath the new DimensionSpacePoint, but not underneath the old. When I am in workspace "migration-workspace" and dimension space point {"language": "de"} + Then I expect the workspace to point to content stream "migration-cs" Then I expect node aggregate identifier "sir-david-nodenborough" to lead to no node When I am in workspace "migration-workspace" and dimension space point {"language": "de_DE"} Then I expect a node identified by migration-cs;sir-david-nodenborough;{"language": "de_DE"} to exist in the content graph diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature index 4ab6fc9c584..3c2798d7bda 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W8-IndividualNodePublication/04-AllFeaturePublication.feature @@ -38,7 +38,7 @@ Feature: Publishing hide/show scenario of nodes | Key | Value | | workspaceName | "live" | | newContentStreamId | "cs-identifier" | - And I am in workspace "live" + And I am in workspace "live" and dimension space point {} And the command CreateRootNodeAggregateWithNode is executed with payload: | Key | Value | | nodeAggregateId | "lady-eleonode-rootford" | @@ -104,12 +104,13 @@ Feature: Publishing hide/show scenario of nodes | contentStreamIdForRemainingPart | "remaining-cs-id" | | contentStreamIdForMatchingPart | "matching-cs-id" | - When I am in workspace "live" and dimension space point {} + When I am in workspace "live" Then I expect node aggregate identifier "sir-david-nodenborough" to lead to no node And I expect node aggregate identifier "nody-mc-nodeface" to lead to no node And I expect node aggregate identifier "sir-nodeward-nodington-iii" to lead to node cs-identifier;sir-nodeward-nodington-iii;{} - When I am in content stream "remaining-cs-id" and dimension space point {} + When I am in workspace "user-test" + Then I expect the workspace to point to content stream "remaining-cs-id" Then I expect node aggregate identifier "sir-david-nodenborough" to lead to no node And I expect node aggregate identifier "nody-mc-nodeface" to lead to no node And I expect node aggregate identifier "sir-nodeward-nodington-iii" to lead to no node diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/Workspaces/PruneContentStreams.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/Workspaces/PruneContentStreams.feature index d97c1c7ec15..ce6cf783931 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/Workspaces/PruneContentStreams.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/Workspaces/PruneContentStreams.feature @@ -53,6 +53,9 @@ Feature: If content streams are not in use anymore by the workspace, they can be | workspaceName | "user-test" | | baseWorkspaceName | "live" | | newContentStreamId | "user-cs-identifier" | + When I am in workspace "user-test" and dimension space point {} + Then I expect the workspace to point to content stream "user-cs-identifier" + When the command RebaseWorkspace is executed with payload: | Key | Value | | workspaceName | "user-test" | @@ -60,11 +63,10 @@ Feature: If content streams are not in use anymore by the workspace, they can be # now, we have one unused content stream (the old content stream of the user-test workspace) When I prune unused content streams - - When I am in content stream "user-cs-identifier" and dimension space point {} - Then I expect node aggregate identifier "root-node" to lead to no node + Then I expect the content stream "user-cs-identifier" to not exist When I am in workspace "user-test" and dimension space point {} + Then I expect the workspace to point to content stream "user-cs-identifier-rebased" Then I expect node aggregate identifier "root-node" to lead to node user-cs-identifier-rebased;root-node;{} Scenario: NO_LONGER_IN_USE content streams can be cleaned up completely (simple case) diff --git a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteTrait.php b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteTrait.php index 057edaa23b6..3fc538f3203 100644 --- a/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteTrait.php +++ b/Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteTrait.php @@ -25,7 +25,6 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria; use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; -use Neos\ContentRepository\Core\Projection\Workspace\Workspace; use Neos\ContentRepository\Core\Service\ContentStreamPruner; use Neos\ContentRepository\Core\Service\ContentStreamPrunerFactory; use Neos\ContentRepository\Core\SharedModel\Exception\RootNodeAggregateDoesNotExist; @@ -132,31 +131,31 @@ protected function readPayloadTable(TableNode $payloadTable): array } /** - * @Then /^workspace "([^"]*)" points to another content stream than workspace "([^"]*)"$/ + * @Then /^I expect the content stream "([^"]*)" to not exist$/ */ - public function workspacesPointToDifferentContentStreams(string $rawWorkspaceNameA, string $rawWorkspaceNameB): void + public function iExpectTheContentStreamToNotExist(string $rawContentStreamId): void { - $workspaceA = $this->currentContentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::fromString($rawWorkspaceNameA)); - Assert::assertInstanceOf(Workspace::class, $workspaceA, 'Workspace "' . $rawWorkspaceNameA . '" does not exist.'); - $workspaceB = $this->currentContentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::fromString($rawWorkspaceNameB)); - Assert::assertInstanceOf(Workspace::class, $workspaceB, 'Workspace "' . $rawWorkspaceNameB . '" does not exist.'); - if ($workspaceA && $workspaceB) { - Assert::assertNotEquals( - $workspaceA->currentContentStreamId->value, - $workspaceB->currentContentStreamId->value, - 'Workspace "' . $rawWorkspaceNameA . '" points to the same content stream as "' . $rawWorkspaceNameB . '"' - ); - } + Assert::assertTrue( + $this->currentContentRepository->getContentStreamFinder()->hasContentStream(ContentStreamId::fromString($rawContentStreamId)), + sprintf('The content stream "%s" does exist.', $rawContentStreamId) + ); } /** - * @Then /^workspace "([^"]*)" does not point to content stream "([^"]*)"$/ + * @Then /^I expect the workspace to point to content stream "([^"]*)"$/ */ - public function workspaceDoesNotPointToContentStream(string $rawWorkspaceName, string $rawContentStreamId): void + public function iExpectTheWorkspaceToPointToContentStream(string $rawContentStreamId): void { - $workspace = $this->currentContentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::fromString($rawWorkspaceName)); + if ($this->currentContentStreamId !== null) { + throw new \RuntimeException('programming error. invalid case.'); + } + + $workspace = $this->currentContentRepository->getWorkspaceFinder()->findOneByName($this->currentWorkspaceName); - Assert::assertNotEquals($rawContentStreamId, $workspace->currentContentStreamId->value); + Assert::assertTrue( + ContentStreamId::fromString($rawContentStreamId)->equals($workspace->currentContentStreamId), + sprintf('The workspace %s was expected to point to %s but points to %s actually.', $this->currentWorkspaceName->value, $rawContentStreamId, $workspace->currentContentStreamId->value) + ); } /**