anthonyedmonds / laravel-testing-traits
Make testing easier with this collection of testing traits!
0.5.0
2024-10-07 10:09 UTC
Requires
- php: ^8.3
- laravel/framework: ^11
- phpunit/phpunit: ^11
README
Make testing easier with this collection of testing traits!
Installation
- Add the library using Composer:
composer require anthonyedmonds/laravel-testing-traits --dev
- The service provider will be automatically registered. If required, you can manually register the service provider by adding it to your bootstrap/providers.php:
return [ ... AnthonyEdmonds\GovukLaravel\Providers\GovukServiceProvider::class, ... ];
- If you are not using the standard
App\Models\User
model, publish the config file using Artisan:
Then update the config to point to your model:php artisan vendor:publish --provider="AnthonyEdmonds\LaravelTestingTraits\TestingTraitsServiceProvider"
return [ 'user_model' => \App\Models\User::class, ];
Usage
- Add the desired traits to your
Tests\TestCase.php
class - Use the test methods in your tests:
$this->assertFormRequestPasses(...); $this->assertBelongsTo(...);