youTubeService = $this->mockIocDependency(YouTubeService::class); } /** * @throws Exception */ public function testSearchYouTubeVideos(): void { $this->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->getAsUser("/api/youtube/search/song/{$song->id}?pageToken=foo") ->assertResponseOk(); } }