From 5fbf184134f34633bc150b2e0210c4a97ec285a9 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 24 Apr 2018 22:14:00 +0200 Subject: destaticfy Log classes Signed-off-by: Arthur Schiwon --- tests/lib/LoggerTest.php | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'tests/lib/LoggerTest.php') diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 6b9c9af8639..3d0847d6c8a 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -11,7 +11,7 @@ namespace Test; use OC\Log; use OCP\ILogger; -class LoggerTest extends TestCase { +class LoggerTest extends TestCase implements Log\IWritable { /** @var \OC\SystemConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; @@ -23,15 +23,15 @@ class LoggerTest extends TestCase { private $logger; /** @var array */ - static private $logs = array(); + private $logs = []; protected function setUp() { parent::setUp(); - self::$logs = array(); + $this->logs = []; $this->config = $this->createMock(\OC\SystemConfig::class); $this->registry = $this->createMock(\OCP\Support\CrashReport\IRegistry::class); - $this->logger = new Log('Test\LoggerTest', $this->config, null, $this->registry); + $this->logger = new Log($this, $this->config, null, $this->registry); } public function testInterpolation() { @@ -63,11 +63,11 @@ class LoggerTest extends TestCase { } private function getLogs() { - return self::$logs; + return $this->logs; } - public static function write($app, $message, $level) { - self::$logs[]= "$level $message"; + public function write($app, $message, $level) { + $this->logs[]= "$level $message"; } public function userAndPasswordData() { @@ -202,23 +202,4 @@ class LoggerTest extends TestCase { $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } - - public function dataGetLogClass() { - return [ - ['file', \OC\Log\File::class], - ['errorlog', \OC\Log\Errorlog::class], - ['syslog', \OC\Log\Syslog::class], - - ['owncloud', \OC\Log\File::class], - ['nextcloud', \OC\Log\File::class], - ['foobar', \OC\Log\File::class], - ]; - } - - /** - * @dataProvider dataGetLogClass - */ - public function testGetLogClass($type, $class) { - $this->assertEquals($class, Log::getLogClass($type)); - } } -- cgit v1.2.3