Package Data | |
---|---|
Maintainer Username: | jasonmccreary |
Maintainer Contact: | jason@pureconcepts.net (Jason McCreary) |
Package Create Date: | 2019-06-25 |
Package Last Update: | 2024-06-10 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:20:53 |
Package Statistics | |
---|---|
Total Downloads: | 2,526,202 |
Monthly Downloads: | 58,876 |
Daily Downloads: | 2,251 |
Total Stars: | 322 |
Total Watchers: | 8 |
Total Forks: | 35 |
Total Open Issues: | 3 |
A set of helpful assertions when testing Laravel applications.
Your application must be running the latest LTS version (5.5) or higher and using Laravel's testing harness.
You may install these assertions with Composer by running:
composer require --dev jasonmccreary/laravel-test-assertions
Afterwards, add the trait to your base TestCase
class:
<?php
namespace Tests;
use JMac\Testing\Traits\HttpTestAssertions;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication, HttpTestAssertions;
}
This package adds several assertions helpful when writing Http Tests.
assertActionUsesFormRequest(string $controller, string $method, string $form_request)
Verifies the action for a given controller performs validation using the given form request.
assertActionUsesMiddleware(string $controller, string $method, string|array $middleware)
Verifies the action for a given controller uses the given middleware or set of middleware.
LaravelMatchers::isModel(Model $model = null)
Matches an argument is the same as $model
. When called without $model
, will match any argument of type Illuminate\Database\Eloquent\Model
.
LaravelMatchers::isCollection(Collection $collection = null)
Matches an argument equals $collection
. When called without $collection
, will match any argument of type Illuminate\Support\Collection
.
LaravelMatchers::isEloquentCollection(Collection $collection = null)
Matches an argument equals $collection
. When called without $collection
, will match any argument of type \Illuminate\Database\Eloquent\Collection
.