From acf62afe2d36accec793accdfee68881e74589cb 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 af0ca140cb..5ba1969861 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 abb9deebd5..8bae8d1822 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)); + } }