New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

roundly-consulting/testing-for-laravel

Dev-only test machinery for Laravel packages and apps: base test cases, a structural migration-order pin, and Pest expectations that can always fail
3,186 5
Install
composer require roundly-consulting/testing-for-laravel
Latest Version:1.6.1
PHP:^8.4
Laravel:12 · 13
License:MIT
Last Updated:Oct 17, 2026
Links: GitHub  ·  Packagist
Maintainer: mihaliak

Testing for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Testing for Laravel

The test suite that can't lie to you. A dev-only package — install it with --dev, it never ships to production — with test machinery for Laravel packages and applications: base test cases, a structural migration-order pin, a both-directions config contract, a secret-safe about capture and architecture presets, each built so it can always fail.

Installation

Requires PHP 8.4, Laravel 12 or 13, and Pest 4 (or Pest 5 on Laravel 13).

composer require --dev roundly-consulting/testing-for-laravel --with-all-dependencies

--with-all-dependencies lets Composer move the phpunit/phpunit version a fresh Laravel app locks to one your Pest major supports (PHPUnit 12 for Pest 4, PHPUnit 13 for Pest 5).

Usage

Point your package's tests/TestCase.php at the base case (in-memory SQLite, foreign keys on, migrations loaded by provider class):

use RoundlyConsulting\Testing\PackageTestCase;
use RoundlyConsulting\Wallet\WalletServiceProvider;

abstract class TestCase extends PackageTestCase
{
    protected function packageProviders(): array
    {
        return [WalletServiceProvider::class];
    }

    protected function migrationSources(): array
    {
        return [WalletServiceProvider::class];
    }
}

Then pin what the package ships — every assertion fails over an empty parse instead of passing:

use RoundlyConsulting\Testing\Arch\ArchPresets;

it('has a runnable migration order', function (): void {
    expect(__DIR__.'/../../database/migrations')
        ->toHaveRunnableMigrationOrder(foreignKeys: 3, externalTables: ['users']);
});

it('ships exactly the config keys it reads', function (): void {
    expect(__DIR__.'/../../config/wallet.php')->toSatisfyConfigContract(__DIR__.'/../../src');
});

ArchPresets::strictTypes('RoundlyConsulting\Wallet');
ArchPresets::finalByDefault('RoundlyConsulting\Wallet');
ArchPresets::noDebuggingLeftovers();

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/testing-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

MIT. See LICENSE.md.

Related Packages

jeffersongoncalves/pest-plugin-database-migrations

Load a package's migrations in tests in the exact order declared by its spatie/l...

652 1
odinns/phpstan-pest-this

PHPStan extensions to infer Pest closure $this type from test file mappings.

3,129 1
eubentof/gherkish

Keep Gherkin scenarios and Pest tests in sync in Laravel applications.

219 2
cooper/hyperf-pest

Pest Testing for hyperf

29 2
rawphp/warp

Warm-worker test engine for Laravel + Pest — boots the app once per process and...

2,557 1

Version History

Version Released PHP Laravel License
1.6.1 ^8.4 ^12.0|^13.0 MIT
1.6.0 ^8.4 ^12.0|^13.0 MIT
1.5.0 ^8.4 ^12.0|^13.0 MIT
1.4.0 ^8.4 ^12.0|^13.0 MIT
1.3.0 ^8.4 ^12.0|^13.0 MIT