mediaScanner = self::mock(MediaScanner::class); } public function testSaveSettings(): void { $this->mediaScanner->shouldReceive('scan')->once() ->andReturn(ScanResultCollection::create()); $this->putAs('/api/settings', ['media_path' => __DIR__], create_admin()) ->assertSuccessful(); self::assertSame(__DIR__, Setting::get('media_path')); } public function testNonAdminCannotSaveSettings(): void { $this->putAs('/api/settings', ['media_path' => __DIR__]) ->assertForbidden(); } public function testMediaPathCannotBeSetForCloudStorage(): void { config(['koel.storage_driver' => 's3']); $this->putAs('/api/settings', ['media_path' => __DIR__], create_admin()) ->assertUnprocessable(); config(['koel.storage_driver' => 'local']); } }