Skip to content

Commit a3b2d4d

Browse files
committed
test: update test code
1 parent 3f53cce commit a3b2d4d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/system/Log/LoggerTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
1818
use Exception;
1919
use Tests\Support\Log\Handlers\TestHandler;
20+
use TypeError;
2021

2122
/**
2223
* @internal
@@ -48,14 +49,14 @@ public function testLogThrowsExceptionOnInvalidLevel(): void
4849
$logger->log('foo', '');
4950
}
5051

51-
public function testLogReturnsFalseWhenLogNotHandled(): void
52+
public function testLogAlwaysReturnsVoid(): void
5253
{
5354
$config = new LoggerConfig();
5455
$config->threshold = 3;
5556

5657
$logger = new Logger($config);
5758

58-
$this->assertFalse($logger->log('debug', ''));
59+
$this->assertNull($logger->log('debug', ''));
5960
}
6061

6162
public function testLogActuallyLogs(): void
@@ -361,16 +362,12 @@ public function testLogLevels(): void
361362

362363
public function testNonStringMessage(): void
363364
{
365+
$this->expectException(TypeError::class);
366+
364367
$config = new LoggerConfig();
365368
$logger = new Logger($config);
366369

367-
$expected = '[Tests\Support\Log\Handlers\TestHandler]';
368370
$logger->log(5, $config);
369-
370-
$logs = TestHandler::getLogs();
371-
372-
$this->assertCount(1, $logs);
373-
$this->assertStringContainsString($expected, $logs[0]);
374371
}
375372

376373
public function testDetermineFileNoStackTrace(): void

0 commit comments

Comments
 (0)