Skip to content

Commit

Permalink
Add test for setBasePath functionality, refs #1873
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Apr 12, 2024
1 parent 24e0e45 commit 84638a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Monolog/Formatter/LineFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ public function testIndentStackTraces(): void
$this->assertStringContainsString(' #1', $message);
}

public function testBasePath(): void
{
$formatter = new LineFormatter();
$formatter->includeStacktraces();
$formatter->setBasePath(dirname(dirname(dirname(__DIR__))));
$formatter->indentStackTraces(' ');
$message = $formatter->format($this->getRecord(message: "foo", context: ['exception' => new RuntimeException('lala')]));

$this->assertStringContainsString(' [stacktrace]', $message);
$this->assertStringContainsString(' #0 vendor/phpunit/phpunit/src/Framework/TestCase.php', $message);
$this->assertStringContainsString(' #1 vendor/phpunit/phpunit/', $message);
}

#[DataProvider('providerMaxLevelNameLength')]
public function testMaxLevelNameLength(?int $maxLength, Level $logLevel, string $expectedLevelName): void
{
Expand Down

0 comments on commit 84638a5

Please sign in to comment.