Laravelのテストコード内でFakerを使いたい
はじめに こんばんは。 全く知らなかったLaravelの機能で、テストコード上でFakerを使う備忘録です。 本題 <?php namespace Tests; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; class UserCreateActionTest extends TestCase { use WithFaker; public test_invoke() { // 以下みたいな感じで使える $this->faker->name, $this->faker->email, } } 終わりに お恥ずか…
2024/05/25 23:59