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