anthonyedmonds / laravel-testing-traits
使用这个测试特性集合使测试更加容易!
0.2.0
2024-09-11 11:38 UTC
Requires
- php: ^8.3
- laravel/framework: ^11
- phpunit/phpunit: ^11
README
使用这个测试特性集合使测试更加容易!
安装
- 使用Composer添加库
composer require anthonyedmonds\laravel-database-log --dev
- 服务提供者将被自动注册。如果需要,您可以手动注册服务提供者,将其添加到您的bootstrap/providers.php中
return [ ... AnthonyEdmonds\GovukLaravel\Providers\GovukServiceProvider::class, ... ];
- 如果您不使用标准的
App\Models\User
模型,请使用Artisan发布配置文件
然后更新配置以指向您的模型php artisan vendor:publish --provider="AnthonyEdmonds\LaravelTestingTraits\TestingTraitsServiceProvider"
return [ 'user_model' => \App\Models\User::class, ];
用法
- 将所需的特性添加到您的
Tests\TestCase.php
类中 - 在您的测试中使用测试方法
$this->assertFormRequestPasses(...); $this->assertBelongsTo(...);