Download the PHP package kishieel/laravel-form-request-unit without Composer
On this page you can find all versions of the php package kishieel/laravel-form-request-unit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-form-request-unit
Laravel Form Request Unit
Helpers for laravel form request unit testing. It allows you to keep your controller tests clean and focus on testing their proper purpose by taking form request assertions to separate tests.
Installation
You can install the package via composer:
Usage
Rules Validation
With FormRequestValidator
trait you may test your FormRequest
without direct request to controller. Mentioned trait
provide validate
method which takes FormRequest
and data which should be validated as arguments.
As a result you will get ValidatorResponse
which provide passes
and errors
methods. First method allow you to
determinate whether data passes validation against form request rules. Second method may be used when you expected
validation fail and want to determinate whether data failed against expected rule.
Selective Validation
With a very complex FormRequest
, you may want to test data against only specified rules. You may achieve this by
passing array of rule keys as third parameter of validate
method.
Authorization Validation
With FormRequestValidator
you may validate FormRequest
authorization method. Result will be available via
passes
method on validation result.
Testing Custom Validation Rules
In case of custom validation rules you may use FormRequestCreator
to create FormRequest
on runtime and test it
against your data. FormRequestCreator
takes rules array and authorization callback as constructor arguments. Arguments
are optional. You may use setRules
and setAuthorization
methods if you prefer.
Contributing
Before any pull request to master
branch please run cs fixer and unit test.
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-form-request-unit with dependencies
illuminate/contracts Version ^7.0|^8.0
illuminate/support Version ^7.0|^8.0
illuminate/validation Version ^7.0|^8.0