Add tests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-01-09 10:55:40 +01:00
parent 7573fa3148
commit e7ff1ba548
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 17 additions and 1 deletions

View 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;

View 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));
}
}