-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5331 from mhsdesign/bugfix/change-base-workspace
BUGFIX: Change base workspace
- Loading branch information
Showing
8 changed files
with
406 additions
and
20 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
...havioralTests/Tests/Behavior/Features/W11-ChangeBaseWorkspace/01-ConstraintChecks.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
@contentrepository @adapters=DoctrineDBAL | ||
Feature: Change base workspace constraints | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.ContentRepository.Testing:Content': | ||
properties: | ||
text: | ||
type: string | ||
'Neos.ContentRepository.Testing:Document': | ||
childNodes: | ||
child1: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
child2: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
""" | ||
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" | | ||
And I am in workspace "live" | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.ContentRepository:Root" | | ||
|
||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "user-cs-identifier" | | ||
|
||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "shared-cs-identifier" | | ||
|
||
Scenario: Changing the base workspace is not allowed for root workspaces | ||
And the command CreateRootWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "groot" | | ||
| newContentStreamId | "cs-groot-identifier" | | ||
|
||
When the command ChangeBaseWorkspace is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| baseWorkspaceName | "groot" | | ||
|
||
Then the last command should have thrown an exception of type "WorkspaceHasNoBaseWorkspaceName" | ||
|
||
Scenario: Changing the base workspace is not allowed if there are pending changes | ||
When the command CreateNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| nodeAggregateId | "holy-nody" | | ||
| nodeTypeName | "Neos.ContentRepository.Testing:Content" | | ||
| originDimensionSpacePoint | {} | | ||
| parentNodeAggregateId | "lady-eleonode-rootford" | | ||
| initialPropertyValues | {"text": "New node in shared"} | | ||
|
||
Given I am in workspace "user-test" and dimension space point {} | ||
Then I expect node aggregate identifier "holy-nody" to lead to node user-cs-identifier;holy-nody;{} | ||
|
||
When the command ChangeBaseWorkspace is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "user-rebased-cs-identifier" | | ||
|
||
Then the last command should have thrown an exception of type "WorkspaceIsNotEmptyException" | ||
|
||
Scenario: Changing the base workspace does not work if the new base is the current workspace (cyclic) | ||
When the command ChangeBaseWorkspace is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "user-test" | | ||
|
||
Then the last command should have thrown an exception of type "BaseWorkspaceEqualsWorkspaceException" | ||
|
||
Scenario: Changing the base workspace does not work if the new base is a base of the current (cyclic) | ||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared-branched" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "shared-branched-cs-identifier" | | ||
|
||
When the command ChangeBaseWorkspace is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| workspaceName | "shared" | | ||
| baseWorkspaceName | "shared-branched" | | ||
|
||
Then the last command should have thrown an exception of type "CircularRelationBetweenWorkspacesException" | ||
|
||
Scenario: Changing the base workspace does not work if the new base complexly cyclic | ||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared-a" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "shared-a-cs-identifier" | | ||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared-a1" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "shared-a1-cs-identifier" | | ||
When the command ChangeBaseWorkspace is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| workspaceName | "shared" | | ||
| baseWorkspaceName | "shared-a1" | | ||
Then the last command should have thrown an exception of type "CircularRelationBetweenWorkspacesException" |
138 changes: 138 additions & 0 deletions
138
....BehavioralTests/Tests/Behavior/Features/W11-ChangeBaseWorkspace/02-BasicFeatures.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
@contentrepository @adapters=DoctrineDBAL | ||
Feature: Change base workspace works :D what else | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.ContentRepository.Testing:Content': | ||
properties: | ||
text: | ||
type: string | ||
'Neos.ContentRepository.Testing:Document': | ||
childNodes: | ||
child1: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
child2: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
""" | ||
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" | | ||
And I am in workspace "live" | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.ContentRepository:Root" | | ||
When the command CreateNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| nodeAggregateId | "nody-mc-nodeface" | | ||
| nodeTypeName | "Neos.ContentRepository.Testing:Content" | | ||
| originDimensionSpacePoint | {} | | ||
| parentNodeAggregateId | "lady-eleonode-rootford" | | ||
| initialPropertyValues | {"text": "Original text"} | | ||
|
||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "user-cs-identifier" | | ||
|
||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "shared-cs-identifier" | | ||
|
||
Scenario: Change base workspace is a no-op if the base already matches | ||
When the command ChangeBaseWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
|
||
Then I expect exactly 1 event to be published on stream "Workspace:user-test" | ||
And event at index 0 is of type "WorkspaceWasCreated" with payload: | ||
| Key | Expected | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "user-cs-identifier" | | ||
|
||
Given I am in workspace "user-test" and dimension space point {} | ||
Then I expect node aggregate identifier "nody-mc-nodeface" to lead to node user-cs-identifier;nody-mc-nodeface;{} | ||
|
||
Scenario: Change base workspace is a no-op if the base already matches but the workspace is outdated | ||
When the command CreateNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| nodeAggregateId | "holy-nody" | | ||
| nodeTypeName | "Neos.ContentRepository.Testing:Content" | | ||
| originDimensionSpacePoint | {} | | ||
| parentNodeAggregateId | "lady-eleonode-rootford" | | ||
| initialPropertyValues | {"text": "New node in live"} | | ||
|
||
Then workspaces user-test has status OUTDATED | ||
|
||
When the command ChangeBaseWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
|
||
Then workspaces user-test has status OUTDATED | ||
|
||
Then I expect exactly 1 event to be published on stream "Workspace:user-test" | ||
And event at index 0 is of type "WorkspaceWasCreated" with payload: | ||
| Key | Expected | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "user-cs-identifier" | | ||
|
||
Given I am in workspace "user-test" and dimension space point {} | ||
Then I expect node aggregate identifier "holy-nody" to lead to no node | ||
|
||
Given I am in workspace "live" and dimension space point {} | ||
Then I expect node aggregate identifier "holy-nody" to lead to node cs-identifier;holy-nody;{} | ||
|
||
Scenario: Change base workspace if user has no changes and is up to date with new base | ||
When the command ChangeBaseWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "user-rebased-cs-identifier" | | ||
|
||
Then workspaces user-test has status UP_TO_DATE | ||
|
||
Given I am in workspace "user-test" and dimension space point {} | ||
# todo no fork needed? | ||
Then I expect node aggregate identifier "nody-mc-nodeface" to lead to node user-rebased-cs-identifier;nody-mc-nodeface;{} | ||
|
||
Scenario: Change base workspace if user has no changes and is not up to date with new base | ||
When the command CreateNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "shared" | | ||
| nodeAggregateId | "holy-nody" | | ||
| nodeTypeName | "Neos.ContentRepository.Testing:Content" | | ||
| originDimensionSpacePoint | {} | | ||
| parentNodeAggregateId | "lady-eleonode-rootford" | | ||
| initialPropertyValues | {"text": "New node in shared"} | | ||
|
||
Given I am in workspace "shared" and dimension space point {} | ||
Then I expect node aggregate identifier "holy-nody" to lead to node shared-cs-identifier;holy-nody;{} | ||
|
||
When the command ChangeBaseWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "shared" | | ||
| newContentStreamId | "user-rebased-cs-identifier" | | ||
|
||
Then workspaces user-test has status UP_TO_DATE | ||
|
||
Given I am in workspace "user-test" and dimension space point {} | ||
Then I expect node aggregate identifier "holy-nody" to lead to node user-rebased-cs-identifier;holy-nody;{} | ||
And I expect this node to have the following properties: | ||
| Key | Value | | ||
| text | "New node in shared" | |
Oops, something went wrong.