aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-07-03 15:51:36 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-07-03 16:03:44 +0000
commit8c6101741c56409f4b6d71101080e6b9c85240e9 (patch)
tree0ab80f20fb59c37650c38e86d4da3bff80f59f2d /tests
parent93b617bddce00dcec18b0910e2695a1df4d2fee9 (diff)
downloadnextcloud-server-8c6101741c56409f4b6d71101080e6b9c85240e9.tar.gz
nextcloud-server-8c6101741c56409f4b6d71101080e6b9c85240e9.zip
fix(tests): Remove output when running tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/LoggerTest.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index 367c34752c1..703d24449aa 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -40,7 +40,16 @@ class LoggerTest extends TestCase implements IWriter {
$this->logger = new Log($this, $this->config, null, $this->registry);
}
+ private function mockDefaultLogLevel(): void {
+ $this->config->expects($this->any())
+ ->method('getValue')
+ ->will(($this->returnValueMap([
+ ['loglevel', ILogger::WARN, ILogger::WARN],
+ ])));
+ }
+
public function testInterpolation() {
+ $this->mockDefaultLogLevel();
$logger = $this->logger;
$logger->warning('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']);
@@ -69,6 +78,7 @@ class LoggerTest extends TestCase implements IWriter {
}
public function testLoggingWithDataArray(): void {
+ $this->mockDefaultLogLevel();
$writerMock = $this->createMock(IWriter::class);
$logFile = new Log($writerMock, $this->config);
$writerMock->expects($this->once())->method('write')->with('no app in context', ['something' => 'extra', 'message' => 'Testing logging with john']);
@@ -104,6 +114,7 @@ class LoggerTest extends TestCase implements IWriter {
* @dataProvider userAndPasswordData
*/
public function testDetectlogin(string $user, string $password): void {
+ $this->mockDefaultLogLevel();
$e = new \Exception('test');
$this->registry->expects($this->once())
->method('delegateReport')
@@ -126,6 +137,7 @@ class LoggerTest extends TestCase implements IWriter {
* @dataProvider userAndPasswordData
*/
public function testDetectcheckPassword(string $user, string $password): void {
+ $this->mockDefaultLogLevel();
$e = new \Exception('test');
$this->registry->expects($this->once())
->method('delegateReport')
@@ -148,6 +160,7 @@ class LoggerTest extends TestCase implements IWriter {
* @dataProvider userAndPasswordData
*/
public function testDetectvalidateUserPass(string $user, string $password): void {
+ $this->mockDefaultLogLevel();
$e = new \Exception('test');
$this->registry->expects($this->once())
->method('delegateReport')
@@ -170,6 +183,7 @@ class LoggerTest extends TestCase implements IWriter {
* @dataProvider userAndPasswordData
*/
public function testDetecttryLogin(string $user, string $password): void {
+ $this->mockDefaultLogLevel();
$e = new \Exception('test');
$this->registry->expects($this->once())
->method('delegateReport')
@@ -192,6 +206,7 @@ class LoggerTest extends TestCase implements IWriter {
* @dataProvider userAndPasswordData
*/
public function testDetectclosure(string $user, string $password): void {
+ $this->mockDefaultLogLevel();
$a = function ($user, $password) {
throw new \Exception('test');
};