Files
ik-codex/test/tests/Detective/MultiPatternDetectorTest.php
indifferentketchup 7c7fe5ca80
Some checks failed
Tests / Run tests on PHP v8.4 (push) Failing after 32s
Tests / Run tests on PHP v8.5 (push) Failing after 2s
Initial import from aternosorg/codex-minecraft
2026-04-30 09:56:57 -05:00

41 lines
1.1 KiB
PHP

<?php
namespace Aternos\Codex\Test\Tests\Detective;
use Aternos\Codex\Detective\MultiPatternDetector;
use Aternos\Codex\Log\File\StringLogFile;
use PHPUnit\Framework\TestCase;
class MultiPatternDetectorTest extends TestCase
{
public function testDetectSinglePattern(): void
{
$this->assertTrue((new MultiPatternDetector())
->setLogFile(new StringLogFile("You can detect this."))
->addPattern('/detect/')
->detect()
);
}
public function testDetectMultiplePatterns(): void
{
$this->assertTrue((new MultiPatternDetector())
->setLogFile(new StringLogFile("You can detect this and this."))
->addPattern('/detect/')
->addPattern('/and this/')
->detect()
);
}
public function testNotDetectMissingFromMultiplePatterns(): void
{
$this->assertFalse((new MultiPatternDetector())
->setLogFile(new StringLogFile("You can detect this and this."))
->addPattern('/detect/')
->addPattern('/and this/')
->addPattern('/but not this/')
->detect()
);
}
}