Add AdminChangedOptionInformation insight

This commit is contained in:
2026-04-30 21:46:13 +00:00
parent caed04db10
commit b7b89ef24e
3 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace IndifferentKetchup\Codex\Test\Tests\Games\ProjectZomboid\Analysis;
use IndifferentKetchup\Codex\Analysis\ProjectZomboid\AdminChangedOptionInformation;
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\AdminPattern;
use PHPUnit\Framework\TestCase;
class AdminChangedOptionInformationTest extends TestCase
{
public function testGetPatternsReturnsEntryRegex(): void
{
$this->assertSame([AdminPattern::CHANGED_OPTION_ENTRY], AdminChangedOptionInformation::getPatterns());
}
public function testEntryRegexMatchesFullLine(): void
{
$line = "[16-04-26 18:36:15.500] AdminUser changed option AnnounceDeath=true.";
$this->assertSame(1, preg_match(AdminPattern::CHANGED_OPTION_ENTRY, $line, $m));
$insight = new AdminChangedOptionInformation();
$insight->setMatches($m, 0);
$this->assertSame('Admin changed option', $insight->getLabel());
$this->assertSame('AdminUser set AnnounceDeath=true', $insight->getValue());
}
}