. */ namespace App\Tests\Services\LogSystem; use App\Services\LogSystem\LogDiffFormatter; use PHPUnit\Framework\TestCase; final class LogDiffFormatterTest extends TestCase { private LogDiffFormatter $service; protected function setUp(): void { $this->service = new LogDiffFormatter(); } public function testPositiveNumericDiff(): void { $result = $this->service->formatDiff(1, 6); $this->assertStringContainsString('text-success', $result); $this->assertStringContainsString('+5', $result); } public function testNegativeNumericDiff(): void { $result = $this->service->formatDiff(10, 3); $this->assertStringContainsString('text-danger', $result); $this->assertStringContainsString('-7', $result); } public function testZeroNumericDiff(): void { $result = $this->service->formatDiff(5, 5); $this->assertStringContainsString('text-muted', $result); $this->assertStringContainsString('0', $result); } public function testStringDiffReturnsNonEmptyHtml(): void { $result = $this->service->formatDiff('hello world', 'hello PHP'); $this->assertNotEmpty($result); // DiffHelper returns HTML $this->assertStringContainsString('<', $result); } public function testUnsupportedTypesReturnEmptyString(): void { // booleans are neither string nor numeric → empty $result = $this->service->formatDiff(true, false); $this->assertSame('', $result); } public function testFloatDiff(): void { $result = $this->service->formatDiff(1.5, 3.0); $this->assertStringContainsString('text-success', $result); } }