Download the PHP package laragear/meta-testing without Composer
On this page you can find all versions of the php package laragear/meta-testing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package meta-testing
Meta Testing
A Laravel Package for testing Laravel Packages.
Become a sponsor
Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can spread the word on social media
Requirements
- Laravel 11 or later.
Installation
Require this package into your project using Composer:
[!DANGER]
DO NOT install this package outside
require-dev
, unless you plan to use this package in production environments.
Testing
Testing the Service Provider
The InteractsWithServiceProvider
allows to quickly test if the Service Provider of your package has registered all the needed bits of code into the Service Container.
The available assertions are in this table:
Methods | ||
---|---|---|
assertServices() |
assertBladeComponent() |
assertGlobalMiddleware() |
assertSingletons() |
assertBladeDirectives() |
assertMiddlewareInGroup() |
assertConfigMerged() |
assertValidationRules() |
assertGateHasPolicy() |
assertPublishes() |
assertRouteByName() |
assertScheduledTask() |
assertPublishesMigrations() |
assertRouteByUri() |
assertScheduledTaskRunsAt() |
assertTranslations() |
assertRouteByAction() |
assertMacro() |
assertViews() |
assertMiddlewareAlias() |
Service Helpers
The InteractsWithServices
trait includes helpers to retrieve services from the Service Container and do quick things like checks or preparation.
Validation
This meta package includes a InteractsWithValidation
trait, that assert if a rule passes or fails using minimal data. This is useful when creating validation rules and testing them without too much boilerplate.
Middleware
You can test a middleware easily using the InteractsWithMiddleware
trait and its middleware()
method. It creates an on-demand route for the given path before sending a test Request to it, so there is no need to register a route.
It proxies all MakesHttpRequest
trait methods, like get()
or withUnencryptedCookie()
, so you can get creative with testing your middleware.
Form Request
You can test a Form Request if it passes authorization a validation using different data using the InteractsWithFormRequests
trait. The formRequest()
requires the Form Request class, and an array
with the data to include in the request, to test in isolation.
Authorization
To check if a policy or gate works appropriately, use the InteractsWithAuthorization
trait to check whether a user can or cannot be authorized to a given action.
Casts
The InteractsWithCast
trait allows to quickly test if a cast sets values from an attribute appropriately, and can return a given value from an attribute value. It also supports checking on multiple attributes at a time.
Laravel Octane compatibility
- There are no singletons using a stale application instance.
- There are no singletons using a stale config instance.
- There are no singletons using a stale request instance.
- There are no static properties being written.
There should be no problems using this package with Laravel Octane.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
This specific package version is licensed under the terms of the MIT License, at time of publishing.
Laravel is a Trademark of Taylor Otwell. Copyright © 2011-2025 Laravel LLC.