diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-04-25 02:27:43 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-26 12:10:52 +0200 |
commit | cfc3ab0119d23a4c8ccccefb13d2271b0c0675ae (patch) | |
tree | dfab8e9dd20412ce46d21eeb42861854193ca56f /tests | |
parent | 5fbf184134f34633bc150b2e0210c4a97ec285a9 (diff) | |
download | nextcloud-server-cfc3ab0119d23a4c8ccccefb13d2271b0c0675ae.tar.gz nextcloud-server-cfc3ab0119d23a4c8ccccefb13d2271b0c0675ae.zip |
offer API to create own File log. admin_audit makes use of it
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Log/FileTest.php | 4 | ||||
-rw-r--r-- | tests/lib/LoggerTest.php | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/lib/Log/FileTest.php b/tests/lib/Log/FileTest.php index 33f0ee8dd19..0c50c6c08ba 100644 --- a/tests/lib/Log/FileTest.php +++ b/tests/lib/Log/FileTest.php @@ -41,7 +41,7 @@ class FileTest extends TestCase $this->restore_logdateformat = $config->getSystemValue('logdateformat'); $config->setSystemValue("logfile", $config->getSystemValue('datadirectory') . "/logtest"); - $this->logFile = new File($config->getSystemValue('datadirectory') . '/logtest'); + $this->logFile = new File($config->getSystemValue('datadirectory') . '/logtest', '', $config); } protected function tearDown() { $config = \OC::$server->getConfig(); @@ -55,7 +55,7 @@ class FileTest extends TestCase } else { $config->deleteSystemValue("logdateformat"); } - $this->logFile = new File($this->restore_logfile); + $this->logFile = new File($this->restore_logfile, '', $config); parent::tearDown(); } diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 3d0847d6c8a..9f226a395b6 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -10,8 +10,9 @@ namespace Test; use OC\Log; use OCP\ILogger; +use OCP\Log\IWriter; -class LoggerTest extends TestCase implements Log\IWritable { +class LoggerTest extends TestCase implements IWriter { /** @var \OC\SystemConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; @@ -29,7 +30,7 @@ class LoggerTest extends TestCase implements Log\IWritable { parent::setUp(); $this->logs = []; - $this->config = $this->createMock(\OC\SystemConfig::class); + $this->config = $this->createMock(\OCP\IConfig::class); $this->registry = $this->createMock(\OCP\Support\CrashReport\IRegistry::class); $this->logger = new Log($this, $this->config, null, $this->registry); } @@ -44,7 +45,7 @@ class LoggerTest extends TestCase implements Log\IWritable { public function testAppCondition() { $this->config->expects($this->any()) - ->method('getValue') + ->method('getSystemValue') ->will(($this->returnValueMap([ ['loglevel', ILogger::WARN, ILogger::WARN], ['log.condition', [], ['apps' => ['files']]] @@ -66,7 +67,7 @@ class LoggerTest extends TestCase implements Log\IWritable { return $this->logs; } - public function write($app, $message, $level) { + public function write(string $app, $message, int $level) { $this->logs[]= "$level $message"; } |