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

Testing Laravel Package

laravel-shield/testing

Testing utilities for Laravel Shield that make it easy to fake, assert, and inspect Shield behavior in your test suite. Includes convenient helpers and assertions for confident, readable tests.

View on GitHub
Deep Wiki
Context7

Testing support package for your drivers.

Frequently asked questions about Testing
What is laravel-shield/testing used for?
It is the testing support package for Laravel Shield, providing utilities that let you fake, assert, and inspect Shield behavior inside your test suite. Instead of hitting real drivers, you can swap in test doubles and verify how your application interacts with Shield. This keeps tests fast, deterministic, and readable.
How do I install laravel-shield/testing in a Laravel application?
Install it with Composer using composer require laravel-shield/testing --dev. It is intended as a development dependency, so keep it out of your production install. After that, reference the helpers and assertions documented in the repository README within your tests.
Should laravel-shield/testing be a dev dependency?
Yes. The package is testing-only tooling and does not belong in production deployments, so install it with the --dev flag. That way composer install --no-dev on your servers will not pull it in. Keep your fake and assertion code in the tests directory as well.
Which Laravel versions does laravel-shield/testing support?
Version support is defined by the package's composer.json constraints, so check those before upgrading Laravel or PHP. Because it is part of the laravel-shield family, it is designed to match the supported versions of the core Shield package. Pin compatible versions in composer.json if you maintain multiple applications on different framework releases.
How do I fake Shield behavior in a test?
The package exposes fake helpers that replace the real Shield driver with an in-memory test double. You call the fake before exercising the code under test, then run your normal application flow. This avoids real network calls or external services and makes assertions predictable; see the README for the exact helper names.
What assertions does laravel-shield/testing provide?
It ships assertions that let you verify Shield was called as expected, such as confirming interactions occurred or that nothing was triggered when it should not have been. The exact assertion method names are listed in the package README. Pair them with your existing PHPUnit or Pest expectations for readable test output.
Can I inspect what Shield received during a test?
Yes. The package includes inspection helpers so you can read back the payloads or driver calls that Shield handled during a test. This is useful for asserting that the right data, identifiers, or options were passed through. Use it when a simple boolean assertion is not enough detail.
Does laravel-shield/testing work with both PHPUnit and Pest?
It is built on Laravel's standard testing utilities, so it works with whichever test runner your application uses, including PHPUnit and Pest. You call the same helpers and assertions in either style. If you use Pest, you can wrap the setup calls in a beforeEach hook for cleaner tests.
Can I use laravel-shield/testing to test my own custom Shield driver?
The fakes are aimed at testing application code that depends on Shield rather than the driver internals themselves. For a custom driver, you should still write focused integration tests that exercise the real implementation. Use the fake helpers for the surrounding application logic and the real driver for driver-level behavior.
Are there downsides to relying on Shield fakes in tests?
Fakes trade realism for speed, so they can hide integration problems if used exclusively. Keep a smaller suite of tests that run against the real driver or a sandbox environment to catch contract changes. A common approach is many fast fake-based tests plus a few end-to-end checks, and you can also assert that the fake recorded calls to reduce false positives.
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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel