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.
26 lines
648 B
PHP
26 lines
648 B
PHP
<?php
|
|
|
|
namespace IndifferentKetchup\Codex\Test\Tests\Log\File;
|
|
|
|
use IndifferentKetchup\Codex\Log\File\PathLogFile;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class PathLogFileTest extends TestCase
|
|
{
|
|
public function testGetContent(): void
|
|
{
|
|
$path = __DIR__ . "/../../../data/simple.log";
|
|
$logFile = new PathLogFile($path);
|
|
|
|
$this->assertStringEqualsFile($path, $logFile->getContent());
|
|
}
|
|
|
|
public function testGetPathReturnsConstructorArgument(): void
|
|
{
|
|
$path = __DIR__ . "/../../../data/simple.log";
|
|
$logFile = new PathLogFile($path);
|
|
|
|
$this->assertSame($path, $logFile->getPath());
|
|
}
|
|
}
|