/prooph-phpspec-extension

This extension is NOT maintained anymore, as the prooph/event-sourcing package is NOT.

Primary LanguagePHPOtherNOASSERTION

Prooph PhpSpec extension

Disclaimer

This extension IS NOT part of the Prooph project and is highly experimental.

Installation

You will need the Composer package manager to install this extension.

To install this package, run the following command:

$ composer require --dev gquemenr/prooph-phpspec-extension

Once, the package is install, create or edit your .phpspec.yml configuration file and register the extension:

extensions:
    Prooph\PhpSpec\Extension: ~

Usage

This extension registers 2 matchers that'll help you describe the expected behaviors of your Prooph aggregate roots.

shouldHaveRecorded(string $eventClassname)

This matcher will check if your aggregate root has recorded at least one event of the provided class.

Example

shouldHaveRecordedEventsThat(callable $callback)

This matcher will check that the recorded events of your aggregate root matches conditions specified in the provided callback.

The callback has the following signature:

bool callback ( array $events )

Example