PHPackages                             eventsauce/pest-utilities - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. eventsauce/pest-utilities

ActiveLibrary[Testing &amp; Quality](/categories/testing)

eventsauce/pest-utilities
=========================

Test utilities for EventSauce.

3.4.1(2y ago)2570.4k↓44.1%1MITPHPPHP ^8.0

Since May 13Pushed 2y agoCompare

[ Source](https://github.com/EventSaucePHP/PestUtilities)[ Packagist](https://packagist.org/packages/eventsauce/pest-utilities)[ RSS](/packages/eventsauce-pest-utilities/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (1)

Code generation for EventSauce
------------------------------

[](#code-generation-for-eventsauce)

```
composer require --dev eventsauce/pest-utilities
```

### Usage

[](#usage)

First, create a base test case, as [described in the regular PHPUnit setup](https://eventsauce.io/docs/testing/#1-create-a-base-test-case-for-your-aggregate).

Next, use the base test case in your Pest tests:

```
use function EventSauce\EventSourcing\PestTooling\expectToFail;
use function EventSauce\EventSourcing\PestTooling\given;
use function EventSauce\EventSourcing\PestTooling\nothingShouldHaveHappened;
use function EventSauce\EventSourcing\PestTooling\when;

uses(YourBaseTestCase::class);

it('you can use the object-oriented interface', function () {
    $this->given(
        new ShoppingCartInitiated(),
    )->when(function (ShoppingCart $cart): void {
        $cart->addProduct(new ProductId('garlic sauce'), 250);
    })->then(
        new ProductAddedToCart(new ProductId('garlic sauce'), 250)
    );
});

it('or the function based interface', function () {
    given(new ShoppingCartInitiated());
    when(function (ShoppingCart $cart): void {
        $cart->checkout();
    });
    expectToFail(SorryCantCheckout::becauseThereAreNoProductsInCart());
    nothingShouldHaveHappened();
});

it('or mix it all', function () {
    given(new ShoppingCartInitiated())
        ->when(function (ShoppingCart $cart): void {
            $cart->checkout();
        });
    expectToFail(SorryCantCheckout::becauseThereAreNoProductsInCart())
        ->nothingShouldHaveHappened();
});

it('can be used in a compact manner')
    ->given(new ShoppingCartInitiated())
    ->when(fn (ShoppingCart $cart) => $cart->add(new ProductId('garlic sauce'), 250))
    ->then(new ProductAddedToCart(new ProductId('garlic sauce'), 250))
    ->assertScenario(); // needed for a Pest bug
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Total

2

Last Release

1061d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/534693?v=4)[Frank de Jonge](/maintainers/frankdejonge)[@frankdejonge](https://github.com/frankdejonge)

---

Top Contributors

[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (5 commits)")

### Embed Badge

![Health badge](/badges/eventsauce-pest-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/eventsauce-pest-utilities/health.svg)](https://phpackages.com/packages/eventsauce-pest-utilities)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
