Add LogFileInterface::getPath(): ?string so detectors can dispatch on a filename hint when the original path is known. Default implementation on the abstract LogFile base returns null; PathLogFile records its constructor argument. StringLogFile and StreamLogFile inherit the null default. Tests cover both the path and null-fallback cases.
25 lines
554 B
PHP
25 lines
554 B
PHP
<?php
|
|
|
|
namespace IndifferentKetchup\Codex\Test\Tests\Log\File;
|
|
|
|
use IndifferentKetchup\Codex\Log\File\StringLogFile;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class StringLogFileTest extends TestCase
|
|
{
|
|
public function testGetContent(): void
|
|
{
|
|
$content = uniqid();
|
|
$logFile = new StringLogFile($content);
|
|
|
|
$this->assertEquals($content, $logFile->getContent());
|
|
}
|
|
|
|
public function testGetPathReturnsNull(): void
|
|
{
|
|
$logFile = new StringLogFile("anything");
|
|
|
|
$this->assertNull($logFile->getPath());
|
|
}
|
|
}
|