mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 03:37:34 +02:00
Add test for setBasePath functionality, refs #1873
This commit is contained in:
@@ -292,6 +292,19 @@ class LineFormatterTest extends TestCase
|
|||||||
$this->assertStringContainsString(' #1', $message);
|
$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')]
|
#[DataProvider('providerMaxLevelNameLength')]
|
||||||
public function testMaxLevelNameLength(?int $maxLength, Level $logLevel, string $expectedLevelName): void
|
public function testMaxLevelNameLength(?int $maxLength, Level $logLevel, string $expectedLevelName): void
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user