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

Conversation

bwaidelich
Copy link
Member

@bwaidelich bwaidelich commented Nov 11, 2024

While working on tests for the ContentRepository privileges I realized a couple of inconsistencies with our test suite.
For example:

When the command <SomeCommand> is executed with payload:

behaves differently from

When the command "<SomeCommand>" is executed with payload:

because they map to different step implementations.

Furthermore there was a huge amount of duplication and it wasn't easily possible to emit commands from a different source (i.e. from Scenario Outlines)

With this change, command handling is centralized to the GenericCommandExecutionAndEventPublication trait and it will allow for writing tests like

  Scenario Outline:
    When the command <command> is executed with payload '<command payload>' and exceptions are caught
    Then the last command should have thrown an exception of type "SomeException" with code 1729086686

    Examples:
      | command             | command payload                                                                              |
      | EnableNodeAggregate | {"workspaceName":"live","nodeAggregateId":"a1","nodeVariantSelectionStrategy":"allVariants"} |

Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

👍 by 👀

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

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

Wow thanks that was probably a lot of effort :D

@@ -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

@bwaidelich bwaidelich merged commit 5f230e3 into 9.0 Nov 12, 2024
10 checks passed
@bwaidelich bwaidelich deleted the task/unify-behat-test-command-and-event-dispatching branch November 12, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants