diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index 317ad9c14bf4..8087ff645845 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -17,6 +17,7 @@ use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use Exception; use Tests\Support\Log\Handlers\TestHandler; +use TypeError; /** * @internal @@ -48,14 +49,14 @@ public function testLogThrowsExceptionOnInvalidLevel(): void $logger->log('foo', ''); } - public function testLogReturnsFalseWhenLogNotHandled(): void + public function testLogAlwaysReturnsVoid(): void { $config = new LoggerConfig(); $config->threshold = 3; $logger = new Logger($config); - $this->assertFalse($logger->log('debug', '')); + $this->assertNull($logger->log('debug', '')); } public function testLogActuallyLogs(): void @@ -361,16 +362,12 @@ public function testLogLevels(): void public function testNonStringMessage(): void { + $this->expectException(TypeError::class); + $config = new LoggerConfig(); $logger = new Logger($config); - $expected = '[Tests\Support\Log\Handlers\TestHandler]'; $logger->log(5, $config); - - $logs = TestHandler::getLogs(); - - $this->assertCount(1, $logs); - $this->assertStringContainsString($expected, $logs[0]); } public function testDetermineFileNoStackTrace(): void