diff options
author | Robin Appelman <robin@icewind.nl> | 2018-03-22 15:52:46 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2018-04-10 15:53:43 +0200 |
commit | b9583c6dceae92bec87392bd9a4dc3fcdb208f4c (patch) | |
tree | 363fc32e1269df58fa8589d348e748388004e69e /tests/lib/LoggerTest.php | |
parent | 123d9f0ce960a3ed0010bc8bcd86273d25ce2d50 (diff) | |
download | nextcloud-server-b9583c6dceae92bec87392bd9a4dc3fcdb208f4c.tar.gz nextcloud-server-b9583c6dceae92bec87392bd9a4dc3fcdb208f4c.zip |
Log exceptions as nested array instead of encoded json
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/LoggerTest.php')
-rw-r--r-- | tests/lib/LoggerTest.php | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 6f528bd6fab..9fdbccc24dc 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -96,9 +96,12 @@ class LoggerTest extends TestCase { $logLines = $this->getLogs(); foreach($logLines as $logLine) { + if (is_array($logLine)) { + $logLine = json_encode($logLine); + } $this->assertNotContains($user, $logLine); $this->assertNotContains($password, $logLine); - $this->assertContains('login(*** sensitive parameters replaced ***)', $logLine); + $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } @@ -115,9 +118,12 @@ class LoggerTest extends TestCase { $logLines = $this->getLogs(); foreach($logLines as $logLine) { + if (is_array($logLine)) { + $logLine = json_encode($logLine); + } $this->assertNotContains($user, $logLine); $this->assertNotContains($password, $logLine); - $this->assertContains('checkPassword(*** sensitive parameters replaced ***)', $logLine); + $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } @@ -134,9 +140,12 @@ class LoggerTest extends TestCase { $logLines = $this->getLogs(); foreach($logLines as $logLine) { + if (is_array($logLine)) { + $logLine = json_encode($logLine); + } $this->assertNotContains($user, $logLine); $this->assertNotContains($password, $logLine); - $this->assertContains('validateUserPass(*** sensitive parameters replaced ***)', $logLine); + $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } @@ -153,9 +162,12 @@ class LoggerTest extends TestCase { $logLines = $this->getLogs(); foreach($logLines as $logLine) { + if (is_array($logLine)) { + $logLine = json_encode($logLine); + } $this->assertNotContains($user, $logLine); $this->assertNotContains($password, $logLine); - $this->assertContains('tryLogin(*** sensitive parameters replaced ***)', $logLine); + $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } @@ -177,13 +189,16 @@ class LoggerTest extends TestCase { $logLines = $this->getLogs(); foreach($logLines as $logLine) { + if (is_array($logLine)) { + $logLine = json_encode($logLine); + } $log = explode('\n', $logLine); unset($log[1]); // Remove `testDetectclosure(` because we are not testing this here, but the closure on stack trace 0 $logLine = implode('\n', $log); $this->assertNotContains($user, $logLine); $this->assertNotContains($password, $logLine); - $this->assertContains('{closure}(*** sensitive parameters replaced ***)', $logLine); + $this->assertContains('*** sensitive parameters replaced ***', $logLine); } } |