Add AdminGrantedAccessInformation insight

This commit is contained in:
2026-04-30 21:45:34 +00:00
parent a2faa551a1
commit caed04db10
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\AdminGrantedAccessInformation;
use IndifferentKetchup\Codex\Pattern\ProjectZomboid\AdminPattern;
use PHPUnit\Framework\TestCase;
class AdminGrantedAccessInformationTest extends TestCase
{
public function testGetPatternsReturnsEntryRegex(): void
{
$this->assertSame([AdminPattern::GRANTED_ACCESS_ENTRY], AdminGrantedAccessInformation::getPatterns());
}
public function testEntryRegexMatchesFullLine(): void
{
$line = "[16-04-26 18:35:10.000] AdminUser granted admin access level on Player1.";
$this->assertSame(1, preg_match(AdminPattern::GRANTED_ACCESS_ENTRY, $line, $m));
$insight = new AdminGrantedAccessInformation();
$insight->setMatches($m, 0);
$this->assertSame('Admin granted access', $insight->getLabel());
$this->assertSame('AdminUser granted admin to Player1', $insight->getValue());
}
}