youTubeService = self::mock(YouTubeService::class); } public function testSearchYouTubeVideos(): void { static::createSampleMediaSet(); /** @var Song $song */ $song = Song::query()->first(); $this->youTubeService ->shouldReceive('searchVideosRelatedToSong') ->with(Mockery::on(static fn (Song $retrievedSong) => $song->is($retrievedSong)), 'foo') ->once(); $this->getAs("/api/youtube/search/song/{$song->id}?pageToken=foo") ->assertOk(); } }