From e7ff1ba548ad4f8661f8309157336d376d6fb937 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 9 Jan 2017 10:55:40 +0100 Subject: [PATCH] Add tests Signed-off-by: Joas Schilling --- lib/private/Log.php | 2 +- tests/lib/LoggerTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/private/Log.php b/lib/private/Log.php index af0ca140cb9..5ba19698612 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -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; diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index abb9deebd55..8bae8d18228 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -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)); + } } -- 2.39.5