Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Unify command and event dispatching in Behat tests #5361

Merged
merged 7 commits into from
Nov 12, 2024
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 @@ -50,7 +50,7 @@ Feature: Disable a node aggregate
| affectedOccupiedDimensionSpacePoints | [{}] |
| affectedCoveredDimensionSpacePoints | [{}] |

When the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Feature: Remove NodeAggregate
| nodeTypeName | "Neos.ContentRepository:Root" |
# We have to add another node since root nodes are in all dimension space points and thus cannot be varied
# Node /document
And the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
And the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| parentNodeAggregateId | "lady-eleonode-nodesworth" |
| nodeName | "document" |
# We also want to add a child node to make sure it is correctly removed when the parent is removed
# Node /document/child-document
And the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
And the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "nodimus-prime" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Feature: Dimension mismatch

Scenario: Generalization detection
# Node /document
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:Document" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Properties
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
# Node /document
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:Document" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Tethered Nodes Reordering Structure changes
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
And the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
And the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ Feature: Rebasing auto-created nodes works
And I expect this node to be a child of node user-cs-identifier;nody-mc-nodeface;{}

# - then, for the auto-created child node, set a property.
When the command "SetSerializedNodeProperties" is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodeAggregateId | $this->currentNodeAggregateId |
| originDimensionSpacePoint | {} |
| propertyValues | {"text": {"value":"Modified","type":"string"}} |
| propertiesToUnset | {} |
When the command SetNodeProperties is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodeAggregateId | $this->currentNodeAggregateId |
| originDimensionSpacePoint | {} |
| propertyValues | {"text": "Modified"} |
| propertiesToUnset | {} |

# ensure that live is outdated so the rebase is required:
When the command CreateNodeAggregateWithNode is executed with payload:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ Feature: Publishing hide/show scenario of nodes
| newContentStreamId | "user-cs-identifier" |

# SETUP: set two new nodes in USER workspace
When the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodeAggregateId | "new1-agg" |
| nodeTypeName | "Neos.ContentRepository.Testing:Content" |
| originDimensionSpacePoint | {} |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "foo" |
When the command CreateNodeAggregateWithNodeAndSerializedProperties is executed with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodeAggregateId | "new2-agg" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
namespace Neos\ContentRepository\Core\CommandHandler;

/**
* Common (marker) interface for all commands of the Content Repository
* Common interface for all commands of the Content Repository
*
* @internal because extra commands are no extension point
*/
interface CommandInterface
{
/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self;
bwaidelich marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,4 @@ interface RebasableToOtherWorkspaceInterface extends CommandInterface
public function createCopyForWorkspace(
WorkspaceName $targetWorkspaceName,
): self;

/**
* called during deserialization from metadata
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public static function create(
return new self($workspaceName, $source, $target);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\Feature\NodeCreation\Dto\NodeAggregateIdsByNodePaths;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\PropertyValuesToWrite;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\SerializedPropertyValues;
use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesToWrite;
use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\SerializedNodeReferences;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
Expand Down Expand Up @@ -76,6 +78,32 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
return new self($workspaceName, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, $parentNodeAggregateId, $initialPropertyValues ?: PropertyValuesToWrite::createEmpty(), $succeedingSiblingNodeAggregateId, null, NodeAggregateIdsByNodePaths::createEmpty(), $references ?: NodeReferencesToWrite::createEmpty());
}

public static function fromArray(array $array): self
{
return new self(
WorkspaceName::fromString($array['workspaceName']),
NodeAggregateId::fromString($array['nodeAggregateId']),
NodeTypeName::fromString($array['nodeTypeName']),
isset($array['originDimensionSpacePoint'])
? OriginDimensionSpacePoint::fromArray($array['originDimensionSpacePoint'])
: OriginDimensionSpacePoint::createWithoutDimensions(),
NodeAggregateId::fromString($array['parentNodeAggregateId']),
isset($array['initialPropertyValues'])
? PropertyValuesToWrite::fromArray($array['initialPropertyValues'])
: PropertyValuesToWrite::createEmpty(),
isset($array['succeedingSiblingNodeAggregateId'])
? NodeAggregateId::fromString($array['succeedingSiblingNodeAggregateId'])
: null,
isset($array['nodeName'])
? NodeName::fromString($array['nodeName'])
: null,
isset($array['tetheredDescendantNodeAggregateIds'])
? NodeAggregateIdsByNodePaths::fromArray($array['tetheredDescendantNodeAggregateIds'])
: NodeAggregateIdsByNodePaths::createEmpty(),
isset($array['references']) ? NodeReferencesToWrite::fromArray($array['references']) : NodeReferencesToWrite::createEmpty(),
);
}

public function withInitialPropertyValues(PropertyValuesToWrite $newInitialPropertyValues): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
return new self($workspaceName, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, $parentNodeAggregateId, $initialPropertyValues ?? SerializedPropertyValues::createEmpty(), $succeedingSiblingNodeAggregateId, null, NodeAggregateIdsByNodePaths::createEmpty(), $references ?: SerializedNodeReferences::createEmpty());
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ public static function createFromSubgraphAndStartNode(
);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
{
return new self($workspaceName, $nodeAggregateId, $originDimensionSpacePoint, $propertyValues);
}

public static function fromArray(array $array): self
{
return new self(
WorkspaceName::fromString($array['workspaceName']),
NodeAggregateId::fromString($array['nodeAggregateId']),
OriginDimensionSpacePoint::fromArray($array['originDimensionSpacePoint']),
PropertyValuesToWrite::fromArray($array['propertyValues']),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ public static function create(
);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,15 @@ public static function create(WorkspaceName $workspaceName, DimensionSpacePoint
return new self($workspaceName, $dimensionSpacePoint, $nodeAggregateId, $relationDistributionStrategy, $newParentNodeAggregateId, $newPrecedingSiblingNodeAggregateId, $newSucceedingSiblingNodeAggregateId);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
WorkspaceName::fromString($array['workspaceName']),
DimensionSpacePoint::fromArray($array['dimensionSpacePoint']),
NodeAggregateId::fromString($array['nodeAggregateId']),
RelationDistributionStrategy::fromString($array['relationDistributionStrategy']),
isset($array['relationDistributionStrategy'])
? RelationDistributionStrategy::from($array['relationDistributionStrategy'])
: RelationDistributionStrategy::default(),
isset($array['newParentNodeAggregateId'])
? NodeAggregateId::fromString($array['newParentNodeAggregateId'])
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ enum RelationDistributionStrategy: string implements \JsonSerializable
case STRATEGY_GATHER_ALL = 'gatherAll';
case STRATEGY_GATHER_SPECIALIZATIONS = 'gatherSpecializations';

public static function fromString(?string $serialization): self
public static function default(): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just temporary as we think of making this nullable or introducing and actual Default here. https://github.com/neos/neos-development-collection/pull/5314/files#diff-4a3a69f0f68fa88f95e6a757f42dee32aa9a14a34ed99433e09a6950b5be0ce1

{
return !is_null($serialization)
? self::from($serialization)
: self::STRATEGY_GATHER_ALL;
return self::STRATEGY_GATHER_ALL;
}

public function jsonSerialize(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Neos\ContentRepository\Core\CommandHandler\CommandInterface;
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\PropertyValuesToWrite;
use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesToWrite;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName;
Expand Down Expand Up @@ -47,4 +48,14 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $sou
{
return new self($workspaceName, $sourceNodeAggregateId, $sourceOriginDimensionSpacePoint, $references);
}

public static function fromArray(array $array): self
{
return new self(
WorkspaceName::fromString($array['workspaceName']),
NodeAggregateId::fromString($array['sourceNodeAggregateId']),
OriginDimensionSpacePoint::fromArray($array['sourceOriginDimensionSpacePoint']),
NodeReferencesToWrite::fromArray($array['references']),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $sou
return new self($workspaceName, $sourceNodeAggregateId, $sourceOriginDimensionSpacePoint, $references);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public static function create(WorkspaceName $workspaceName, NodeAggregateId $nod
return new self($workspaceName, $nodeAggregateId, $coveredDimensionSpacePoint, $nodeVariantSelectionStrategy, null);
}

/**
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self
{
return new self(
Expand Down
Loading
Loading