PHPackages                             bradietilley/pest-stories - 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. bradietilley/pest-stories

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

bradietilley/pest-stories
=========================

A tool to assist in creating complex permutations of test case scenarios in Pest PHP (for Laravel)

0.4.0(3y ago)8141[1 issues](https://github.com/bradietilley/pest-stories/issues)MITPHP

Since Mar 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bradietilley/pest-stories)[ Packagist](https://packagist.org/packages/bradietilley/pest-stories)[ Fund](https://ecologi.com/bradietilley?gift-trees)[ GitHub Sponsors](https://github.com/bradietilley)[ RSS](/packages/bradietilley-pest-stories/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (14)Used By (0)

Pest Stories
============

[](#pest-stories)

A clean approach for writing large test suites.

[![Static Analysis](https://github.com/bradietilley/pest-stories/actions/workflows/static.yml/badge.svg)](https://github.com/bradietilley/pest-stories/actions/workflows/static.yml/badge.svg)[![Tests](https://github.com/bradietilley/pest-stories/actions/workflows/tests.yml/badge.svg)](https://github.com/bradietilley/pest-stories/actions/workflows/tests.yml/badge.svg)

Introduction
------------

[](#introduction)

User Stories are short, simple descriptions of a feature or functionality of a software application, typically written from the perspective of an end user.

Pest Stories is a PHP package that extends the PestPHP testing framework, allowing developers to write user stories in a clear and reusable way, making it easier to maintain and test their software applications. The idea is your tests should be written in a human readable way that reflects a user story.

Installation
------------

[](#installation)

```
composer require bradietilley/pest-stories --dev

```

To add Stories to your test suites, you must add the following trait via Pest's `uses()` helper:

```
uses(BradieTilley\Stories\Concerns\Stories::class);
```

*Refer to Pest's documentation on how to use the `uses()` helper.*

Documentation
-------------

[](#documentation)

Read the [docs](/docs/README.md).

Example
-------

[](#example)

`tests/Pest.php`:

```
action('as_admin', function () {
    actingAs(User::factory()->admin()->create());
});

action('as_customer', function () {
    actingAs(User::factory()->customer()->create());
});

action('create_product', function (array $product) {
    return test()->postJson(route('products.store'), array_replace([
        'title' => 'Default',
        'sku' => 'default',
        'price' => 99.99,
    ], $product))
}, 'response');

action('response:ok', function (TestResponse $response) {
    $response->assertOk();
});

action('response:invalid', function (TestResponse $response) {
    $response->assertUnprocessable();
});
```

`tests/Feature/Api/Products/CreateTest.php`:

```
test('can create a product via the api')
    ->action('as_admin')
    ->assertDatabaseMissing('products', [
        'title' => 'Default',
    ])
    ->action('create_product')
    ->assertDatabaseHas('products', [
        'title' => 'Default',
    ]);

test('cannot create a product via the api as a customer')
    ->action('as_customer')
    ->assertDatabaseMissing('products', [
        'title' => 'Default',
    ])
    ->action('create_product')
    ->assertDatabaseMissing('products', [
        'title' => 'Default',
    ]);

test('can create a product via the api with a custom title')
    ->action('as_admin')
    ->assertDatabaseMissing('products', [ 'title' => 'Custom Product' ])
    ->action('create_product', [
        'product' => [
            'title' => 'Custom Product',
        ],
    ])
    ->assertDatabaseHas('products', [ 'title' => 'Custom Product' ]);

test('can create a product via the api with a custom price')
    ->action('as_admin')
    ->assertDatabaseMissing('products', [ 'price' => 12345.67 ])
    ->action('create_product', [
        'product' => [
            'price' => 12345.67,
        ],
    ])
    ->assertDatabaseHas('products', [ 'price' => 12345.67 ]);
```

Of course this just touches on the possible ways of customising Pest Stories to make it your own.

Author
------

[](#author)

- [Bradie Tilley](https://github.com/bradietilley)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.8% 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 ~3 days

Total

13

Last Release

1108d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f93c7d77d882d4106664cca209c6dccc0e531f307f56dc2247937358d193ef0b?d=identicon)[bradietilley](/maintainers/bradietilley)

---

Top Contributors

[![bradietilley](https://avatars.githubusercontent.com/u/44430471?v=4)](https://github.com/bradietilley "bradietilley (434 commits)")[![spaceratz](https://avatars.githubusercontent.com/u/115763514?v=4)](https://github.com/spaceratz "spaceratz (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bradietilley-pest-stories/health.svg)

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

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[illuminate/testing

The Illuminate Testing package.

3315.6M113](/packages/illuminate-testing)[christophrumpel/missing-livewire-assertions

This package adds missing livewire test assertions.

149336.0k9](/packages/christophrumpel-missing-livewire-assertions)[calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

43482.4k3](/packages/calebdw-larastan-livewire)[encodia/laravel-health-env-vars

Custom check for Spatie's Laravel Health - Ensure every .env variable you need has been set

20143.5k](/packages/encodia-laravel-health-env-vars)

PHPackages © 2026

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