create(); $recording = Recording::query()->create([ 'user_id' => $user->id, 'title' => 'Show me', 'original_filename' => 'show.mp3', 'file_path' => 'recordings/show.mp3', 'file_size_bytes' => 100, 'transcription_status' => 'done', 'transcript' => 'Finished text', ]); $this->actingAs($user) ->get(route('recordings.show', $recording)) ->assertOk() ->assertSeeLivewire(Show::class) ->assertSee('Show me') ->assertSee('Play', false); } public function test_user_can_delete_own_recording(): void { Storage::fake('local'); Storage::disk('local')->put('recordings/delete-me.mp3', 'bytes'); $user = User::factory()->create(); $this->actingAs($user); $recording = Recording::query()->create([ 'user_id' => $user->id, 'title' => 'Delete me', 'original_filename' => 'delete-me.mp3', 'file_path' => 'recordings/delete-me.mp3', 'file_size_bytes' => 5, 'transcription_status' => 'done', ]); Livewire::test(Show::class, ['recording' => $recording]) ->call('delete') ->assertRedirect(route('recordings.index')); $this->assertDatabaseMissing('recordings', ['id' => $recording->id]); } }