]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add tests
authorJoas Schilling <coding@schilljs.com>
Mon, 9 Jan 2017 09:55:40 +0000 (10:55 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 10 Jan 2017 12:00:47 +0000 (13:00 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Log.php
tests/lib/LoggerTest.php

index af0ca140cb9d0da9fa987060932246cbe3071162..5ba19698612df1262fa627738340e2249c9bf246 100644 (file)
@@ -339,7 +339,7 @@ class Log implements ILogger {
                $logClass = 'OC\\Log\\' . ucfirst($logType);
 
                if (!class_exists($logClass)) {
-                       $logClass = 'OC\\Log\\File';
+                       $logClass = \OC\Log\File::class;
                }
 
                return $logClass;
index abb9deebd556962ab8487a32e2882ff1726ed60e..8bae8d182283d7257ae9b5cb80d798568253ab8f 100644 (file)
@@ -138,4 +138,20 @@ class LoggerTest extends TestCase {
                }
        }
 
+       public function dataGetLogClass() {
+               return [
+                       ['owncloud', \OC\Log\File::class],
+                       ['nextcloud', \OC\Log\File::class],
+                       ['file', \OC\Log\File::class],
+                       ['errorlog', \OC\Log\Errorlog::class],
+                       ['syslog', \OC\Log\Syslog::class],
+               ];
+       }
+
+       /**
+        * @dataProvider dataGetLogClass
+        */
+       public function testGetLogClass($type, $class) {
+               $this->assertEquals($class, Log::getLogClass($type));
+       }
 }