mediaMetadataService = self::mock(MediaMetadataService::class); } public function testCollaboratorCanUploadCover(): void { /** @var Playlist $playlist */ $playlist = Playlist::factory()->create(); $collaborator = create_user(); $playlist->addCollaborator($collaborator); $this->mediaMetadataService ->shouldReceive('writePlaylistCover') ->once() ->with(Mockery::on(static fn (Playlist $target) => $target->is($playlist)), 'data:image/jpeg;base64,Rm9v'); $this->putAs("api/playlists/$playlist->id/cover", ['cover' => 'data:image/jpeg;base64,Rm9v'], $collaborator) ->assertOk(); } }