diff options
author | Vitor Mattos <vitor@php.rio> | 2022-12-28 16:36:53 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-12-28 16:45:45 -0300 |
commit | 01537ee7d0c96e681c138d03d8364c158769caf4 (patch) | |
tree | e13548b4daf00dd3db8ef7ff0ef09306f208c89c /lib/Config.php | |
parent | 9774c782c13c3750ea9da61babde898376c157e7 (diff) |
Cover method with unit test
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/Config.php')
-rw-r--r-- | lib/Config.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/Config.php b/lib/Config.php index 96ba4914e..89cfa27c9 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -44,6 +44,12 @@ class Config { public const SIGNALING_TICKET_V1 = 1; public const SIGNALING_TICKET_V2 = 2; + public const DEFAULT_ALLOWED_RECORDING_FORMATS = [ + 'audio/ogg' => ['ogg'], + 'video/ogg' => ['ogv'], + 'video/x-matroska' => ['mkv'], + ]; + protected IConfig $config; protected ITimeFactory $timeFactory; private IGroupManager $groupManager; @@ -158,14 +164,16 @@ class Config { } public function getRecordingAllowedMimes(): array { - $defaultMimes = [ - 'audio/ogg' => ['ogg'], - 'video/ogg' => ['ogv'], - 'video/x-matroska' => ['mkv'], - ]; - $allowedMimes = $this->config->getAppValue('spreed', 'allowed_recording_mimes', json_encode($defaultMimes)); + $allowedMimes = $this->config->getAppValue( + 'spreed', + 'allowed_recording_mimes', + json_encode(self::DEFAULT_ALLOWED_RECORDING_FORMATS) + ); $allowedMimes = json_decode($allowedMimes, true); - return is_array($allowedMimes) ? $allowedMimes : $defaultMimes; + if (is_array($allowedMimes) && count($allowedMimes)) { + return $allowedMimes; + } + return self::DEFAULT_ALLOWED_RECORDING_FORMATS; } public function isDisabledForUser(IUser $user): bool { |