Add tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
b61486efca
commit
acf62afe2d
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue