Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-10-27 12:46:20 +0300
committerJoas Schilling <coding@schilljs.com>2018-01-03 12:46:30 +0300
commit903d7fcd6a6866abb992610de311710e0ad4a48d (patch)
tree50b1f88b0d55d23d37ddab004afa6240cdc13a07 /tests
parenta7e67a6ce2c025fb058c9c9620a10ac453607542 (diff)
Unit tests for #6977
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/LoggerTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index da9cedc9f56..3a30bbd1d3b 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -138,6 +138,32 @@ class LoggerTest extends TestCase {
}
}
+ /**
+ * @dataProvider userAndPasswordData
+ */
+ public function testDetectclosure($user, $password) {
+ $a = function($user, $password) {
+ throw new \Exception('test');
+ };
+
+ try {
+ $a($user, $password);
+ } catch (\Exception $e) {
+ $this->logger->logException($e);
+ }
+ $logLines = $this->getLogs();
+
+ foreach($logLines as $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);
+ }
+ }
+
public function dataGetLogClass() {
return [
['file', \OC\Log\File::class],