Skip to content

Commit

Permalink
test: update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 24, 2023
1 parent 3f53cce commit a3b2d4d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/system/Log/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
use Exception;
use Tests\Support\Log\Handlers\TestHandler;
use TypeError;

/**
* @internal
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a3b2d4d

Please sign in to comment.