Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Test Utilities

Test Utilities Laravel Package

wyrihaximus/test-utilities

Test utilities for api-clients packages, providing a PHPStan extension so test classes can extend WyriHaximus\TestUtilities\TestCase, with automatic registration via phpstan/extension-installer or manual inclusion of extension.neon.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Test Utilities
How do I install wyrihaximus/test-utilities in a Laravel project?
Install it as a dev dependency with composer require --dev wyrihaximus/test-utilities. There is no service provider to register, no config file to publish, and no runtime footprint, so nothing changes in your application bootstrapping. You then extend WyriHaximus\TestUtilities\TestCase in your own test classes or project base test case.
Does wyrihaximus/test-utilities support Laravel 11 or Laravel 12?
The package is not Laravel-specific, so support depends entirely on the dependency envelope. As of release 14.5.0 it requires phpunit/phpunit ^13.4.1, while Laravel 10, 11, and 12 ship PHPUnit 9.6 through 12.x, so Composer may refuse to co-install. Verify the constraint against your own platform matrix, or pick a package major that matches your Laravel and PHPUnit line.
How does the PHPStan extension get registered automatically?
The package ships a PHPStan extension that registers itself when phpstan/extension-installer is enabled in your project, requiring no extra configuration from you. If extension-installer is not available you can add the extension manually by including vendor/wyrihaximus/test-utilities/extension.neon in your PHPStan configuration. Either way the extension teaches PHPStan about WyriHaximus\TestUtilities\TestCase so your test classes analyse cleanly.
Why should my test classes extend WyriHaximus\TestUtilities\TestCase?
It gives api-clients packages a single shared base test case instead of every repository rebuilding the same scaffolding. The PHPStan extension that ships with the package is what recognises that base class during static analysis, which is why the two features are documented together. You can still layer your own traits and Laravel helpers on top through a project-local base class.
What PHP and PHPUnit versions does version 14.x require?
Release 14.5.0 pins phpunit/phpunit to ^13.4.1, which is the explicit floor for the 14.x line. PHPUnit 13 is expected to carry a PHP 8.4+ floor, so confirm your PHP platform matrix before assuming it will install. Older majors of this package track older PHPUnit lines if you need to stay on PHP 8.2 or 8.3.
Is this a Laravel package with a service provider and config file?
No. It is a dev-tooling package that provides a base PHPUnit test case and a PHPStan extension, with no service provider, routes, migrations, or publishable configuration. Any Laravel behaviour you want inside your tests has to come from your own base test case, not from this package.
Can I use RefreshDatabase or DatabaseMigrations with this TestCase?
Not natively. The package ships no Laravel database testing utilities, so pairing it with DatabaseMigrations or RefreshDatabase requires a project-local trait or an intermediate base test case that composes both. This is a deliberate scope choice, since the package targets generic api-clients suites rather than Laravel feature tests.
What does the Composer plugin do when wyrihaximus/makefiles is installed?
When wyrihaximus/makefiles is present in the project, the package registers as a Composer plugin and appends make on-install-or-update || true to your composer.json scripts on install and update. If makefiles is absent, that behaviour simply does not trigger and the package acts as a normal test utility library. The || true guard keeps a failing make target from aborting the Composer run.
Why did new PHPStan errors appear after upgrading this package?
The curated rules come through wyrihaximus/phpstan-rules-wrapper, which moves on a fast cadence and changed several times within a single release, from 14.9.0 to 14.10.1. Each bump can alter rule severity or add rules, producing new CI failures without any change to your own code. Generate a baseline first and avoid turning the ruleset into a blocking gate until you have reviewed the output.
Should I use a composer replace block to force an older PHPUnit with this package?
No. Overriding PHPUnit through composer.json replace defeats the package's own version guards and will break silently at the next constraint bump. The safer path is choosing a package major that matches your Laravel and PHPUnit line, or waiting for an upstream release. If you need Laravel-native testing helpers today, Laravel's own TestCase plus orchestra/testbench is a more appropriate foundation.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai