Skip to content

Commit

Permalink
FEATURE: Add test cases for change projection
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Dec 3, 2024
1 parent 8f67be4 commit 519c03f
Show file tree
Hide file tree
Showing 30 changed files with 2,747 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public function iExpectTheChangeProjectionToHaveTheFollowingChangesInContentStre
|| $change->deleted !== (bool)$tableRow['deleted']
|| $change->changed !== (bool)$tableRow['changed']
|| $change->moved !== (bool)$tableRow['moved']
|| !$change->originDimensionSpacePoint->equals(DimensionSpacePoint::fromJsonString($tableRow['originDimensionSpacePoint']))
|| (
($change->originDimensionSpacePoint === null && strtolower($tableRow['originDimensionSpacePoint']) !== "null")
&&
($change->originDimensionSpacePoint !== null && strtolower($tableRow['originDimensionSpacePoint']) !== "null" && !$change->originDimensionSpacePoint->equals(DimensionSpacePoint::fromJsonString($tableRow['originDimensionSpacePoint'])))
)
) {
continue;
}
Expand Down Expand Up @@ -79,4 +83,4 @@ public function iExpectTheChangeProjectionToHaveNoChangesInContentStream(string

Assert::assertSame(0, $changes->count(), "No changes expected.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Feature: Create node aggregate with node without dimensions
Given I am in workspace "live"

And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-david-nodenborough | node | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {} |
| nody-mc-nodeface | child-node | sir-david-nodenborough | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Nody Mc Nodeface"} |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Sir Nodeward Nodington III"} |
Expand All @@ -54,7 +54,7 @@ Feature: Create node aggregate with node without dimensions
Given I am in workspace "user-workspace"

And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-david-nodenborough | node | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {} |
| nody-mc-nodeface | child-node | sir-david-nodenborough | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Nody Mc Nodeface"} |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Sir Nodeward Nodington III"} |
Expand All @@ -65,4 +65,4 @@ Feature: Create node aggregate with node without dimensions
| nody-mc-nodeface | 1 | 1 | 0 | 0 | {} |
| sir-nodeward-nodington-iii | 1 | 1 | 0 | 0 | {} |

And I expect the ChangeProjection to have no changes in "live"
And I expect the ChangeProjection to have no changes in "cs-identifier"
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ Feature: Create node aggregate with node with dimensions
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a french text about Sir Nodeward Nodington III"} |

Then I expect the ChangeProjection to have the following changes in "live":
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
Then I expect the ChangeProjection to have no changes in "cs-identifier"


Scenario: Nodes on user workspace have been created
Expand All @@ -77,18 +76,4 @@ Feature: Create node aggregate with node with dimensions
| nody-mc-nodeface | 1 | 1 | 0 | 0 | {"language":"de"} |
| sir-nodeward-nodington-iv | 1 | 1 | 0 | 0 | {"language":"de"} |
| sir-nodeward-nodington-iii | 1 | 1 | 0 | 0 | {"language":"fr"} |



# When the command PublishIndividualNodesFromWorkspace is executed with payload:
# | Key | Value |
# | nodesToPublish | [{"workspaceName": "user-workspace", "dimensionSpacePoint": {"language":"de"}, "nodeAggregateId": "sir-david-nodenborough"}] |
# | contentStreamIdForRemainingPart | "user-cs-identifier-remaining" |
#
# And I expect the ChangeProjection to have the following changes in "user-cs-identifier-remaining":
# | nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
# | nody-mc-nodeface | 1 | 1 | 0 | 0 | {"language":"de"} |
# | sir-nodeward-nodington-iv | 1 | 1 | 0 | 0 | {"language":"de"} |
# | sir-nodeward-nodington-iii | 1 | 1 | 0 | 0 | {"language":"fr"} |
#
# Then I expect the ChangeProjection to have no changes in "user-cs-id"
And I expect the ChangeProjection to have no changes in "cs-identifier"
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@contentrepository @adapters=DoctrineDBAL
@flowEntities
Feature: Create node generalization variant

Background:
Given using the following content dimensions:
| Identifier | Values | Generalizations |
| language | de,gsw,fr,en | gsw->de->en, fr |
And using the following node types:
"""yaml
'Neos.ContentRepository.Testing:Node':
properties:
text:
type: string
"""
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" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |

And I am in workspace "live"
And I am in dimension space point {"language": "de"}
And I am user identified by "initiating-user-identifier"
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |

And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-david-nodenborough | node | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {} |
| nody-mc-nodeface | child-node | sir-david-nodenborough | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Nody Mc Nodeface"} |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Sir Nodeward Nodington III"} |

And the command CreateWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-workspace" |
| baseWorkspaceName | "live" |
| newContentStreamId | "user-cs-id" |

Scenario: Create node generalization variant of node with
When I am in workspace "user-workspace" and dimension space point {"language":"de"}
And the command CreateNodeVariant is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| sourceOrigin | {"language":"de"} |
| targetOrigin | {"language":"en"} |

Then I expect the ChangeProjection to have no changes in "cs-identifier"
Then I expect the ChangeProjection to have the following changes in "user-cs-id":
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
| sir-david-nodenborough | 1 | 1 | 0 | 0 | {"language":"en"} |

And the command PublishWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-workspace" |
| newContentStreamId | "new-user-workspace-cs-id" |

Then I expect the ChangeProjection to have no changes in "cs-identifier"
Then I expect the ChangeProjection to have no changes in "user-cs-id"
Then I expect the ChangeProjection to have no changes in "new-user-workspace-cs-id"
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@contentrepository @adapters=DoctrineDBAL
@flowEntities
Feature: Create node specialization variant

Background:
Given using the following content dimensions:
| Identifier | Values | Generalizations |
| language | de,gsw,fr | gsw->de, fr |
And using the following node types:
"""yaml
'Neos.ContentRepository.Testing:Node':
properties:
text:
type: string
"""
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" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |

And I am in workspace "live"
And I am in dimension space point {"language": "de"}
And I am user identified by "initiating-user-identifier"
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |


And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-david-nodenborough | node | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {} |
| nody-mc-nodeface | child-node | sir-david-nodenborough | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Nody Mc Nodeface"} |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a french text about Sir Nodeward Nodington III"} |


And the command CreateWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-workspace" |
| baseWorkspaceName | "live" |
| newContentStreamId | "user-cs-id" |

Scenario: Create node specialization variant of node
When I am in workspace "user-workspace" and dimension space point {"language":"de"}
And the command CreateNodeVariant is executed with payload:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| sourceOrigin | {"language":"de"} |
| targetOrigin | {"language":"gsw"} |

Then I expect the ChangeProjection to have the following changes in "user-cs-id":
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
| nody-mc-nodeface | 1 | 1 | 0 | 0 | {"language":"gsw"} |
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@contentrepository @adapters=DoctrineDBAL
@flowEntities
Feature: Create node peer variant with internal workspace between live and user workspace

Background:
Given using the following content dimensions:
| Identifier | Values | Generalizations |
| language | de,gsw,fr | gsw->de, fr |
And using the following node types:
"""yaml
'Neos.ContentRepository.Testing:Node':
properties:
text:
type: string
"""
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" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |

And I am in workspace "live"
And I am in dimension space point {"language": "de"}
And I am user identified by "initiating-user-identifier"
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |


And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | nodeName | parentNodeAggregateId | nodeTypeName | initialPropertyValues |
| sir-david-nodenborough | node | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {} |
| nody-mc-nodeface | child-node | sir-david-nodenborough | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Nody Mc Nodeface"} |
| sir-nodeward-nodington-iii | esquire | lady-eleonode-rootford | Neos.ContentRepository.Testing:Node | {"text": "This is a text about Sir Nodeward Nodington III"} |

And the command CreateWorkspace is executed with payload:
| Key | Value |
| workspaceName | "internal-workspace" |
| baseWorkspaceName | "live" |
| newContentStreamId | "internal-cs-id" |

And the command CreateWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-workspace" |
| baseWorkspaceName | "internal-workspace" |
| newContentStreamId | "user-cs-id" |

Scenario: Create node peer variant of node

When I am in workspace "internal-workspace" and dimension space point {"language":"de"}
And the command CreateNodeVariant is executed with payload:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| sourceOrigin | {"language":"de"} |
| targetOrigin | {"language":"gsw"} |

Then I expect the ChangeProjection to have the following changes in "internal-cs-id":
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
| nody-mc-nodeface | 1 | 1 | 0 | 0 | {"language":"gsw"} |
And I expect the ChangeProjection to have no changes in "cs-identifier"
And I expect the ChangeProjection to have no changes in "user-cs-id"

Scenario: Create node peer variant of node

When I am in workspace "user-workspace" and dimension space point {"language":"de"}
And the command CreateNodeVariant is executed with payload:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| sourceOrigin | {"language":"de"} |
| targetOrigin | {"language":"gsw"} |

Then I expect the ChangeProjection to have the following changes in "user-cs-id":
| nodeAggregateId | created | changed | moved | deleted | originDimensionSpacePoint |
| nody-mc-nodeface | 1 | 1 | 0 | 0 | {"language":"gsw"} |
And I expect the ChangeProjection to have no changes in "cs-identifier"
And I expect the ChangeProjection to have no changes in "internal-cs-id"
Loading

0 comments on commit 519c03f

Please sign in to comment.