Initial import from aternosorg/codex-minecraft
This commit is contained in:
24
test/src/Log/TestAlwaysDetectableLog.php
Normal file
24
test/src/Log/TestAlwaysDetectableLog.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Aternos\Codex\Test\Src\Log;
|
||||
|
||||
use Aternos\Codex\Detective\DetectorInterface;
|
||||
use Aternos\Codex\Detective\SinglePatternDetector;
|
||||
use Aternos\Codex\Log\DetectableLogInterface;
|
||||
use Aternos\Codex\Log\Log;
|
||||
|
||||
/**
|
||||
* Class TestAlwaysDetectableLog
|
||||
*/
|
||||
class TestAlwaysDetectableLog extends Log implements DetectableLogInterface
|
||||
{
|
||||
/**
|
||||
* Get an array of detectors matching DetectorInterface
|
||||
*
|
||||
* @return DetectorInterface[]
|
||||
*/
|
||||
public static function getDetectors(): array
|
||||
{
|
||||
return [(new SinglePatternDetector())->setPattern('/information/')];
|
||||
}
|
||||
}
|
||||
24
test/src/Log/TestLessDetectableLog.php
Normal file
24
test/src/Log/TestLessDetectableLog.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Aternos\Codex\Test\Src\Log;
|
||||
|
||||
use Aternos\Codex\Detective\DetectorInterface;
|
||||
use Aternos\Codex\Detective\LinePatternDetector;
|
||||
use Aternos\Codex\Log\DetectableLogInterface;
|
||||
use Aternos\Codex\Log\Log;
|
||||
|
||||
/**
|
||||
* Class TestLessDetectableLog
|
||||
*/
|
||||
class TestLessDetectableLog extends Log implements DetectableLogInterface
|
||||
{
|
||||
/**
|
||||
* Get an array of detectors matching DetectorInterface
|
||||
*
|
||||
* @return DetectorInterface[]
|
||||
*/
|
||||
public static function getDetectors(): array
|
||||
{
|
||||
return [(new LinePatternDetector())->setPattern('/information/')];
|
||||
}
|
||||
}
|
||||
24
test/src/Log/TestMoreDetectableLog.php
Normal file
24
test/src/Log/TestMoreDetectableLog.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Aternos\Codex\Test\Src\Log;
|
||||
|
||||
use Aternos\Codex\Detective\DetectorInterface;
|
||||
use Aternos\Codex\Detective\LinePatternDetector;
|
||||
use Aternos\Codex\Log\DetectableLogInterface;
|
||||
use Aternos\Codex\Log\Log;
|
||||
|
||||
/**
|
||||
* Class TestMoreDetectableLog
|
||||
*/
|
||||
class TestMoreDetectableLog extends Log implements DetectableLogInterface
|
||||
{
|
||||
/**
|
||||
* Get an array of detectors matching DetectorInterface
|
||||
*
|
||||
* @return DetectorInterface[]
|
||||
*/
|
||||
public static function getDetectors(): array
|
||||
{
|
||||
return [(new LinePatternDetector())->setPattern('/This/')];
|
||||
}
|
||||
}
|
||||
24
test/src/Log/TestNeverDetectableLog.php
Normal file
24
test/src/Log/TestNeverDetectableLog.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Aternos\Codex\Test\Src\Log;
|
||||
|
||||
use Aternos\Codex\Detective\DetectorInterface;
|
||||
use Aternos\Codex\Detective\SinglePatternDetector;
|
||||
use Aternos\Codex\Log\DetectableLogInterface;
|
||||
use Aternos\Codex\Log\Log;
|
||||
|
||||
/**
|
||||
* Class TestNeverDetectableLog
|
||||
*/
|
||||
class TestNeverDetectableLog extends Log implements DetectableLogInterface
|
||||
{
|
||||
/**
|
||||
* Get an array of detectors matching DetectorInterface
|
||||
*
|
||||
* @return DetectorInterface[]
|
||||
*/
|
||||
public static function getDetectors(): array
|
||||
{
|
||||
return [(new SinglePatternDetector())->setPattern('/missing/')];
|
||||
}
|
||||
}
|
||||
40
test/src/Log/TestPatternLog.php
Normal file
40
test/src/Log/TestPatternLog.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Aternos\Codex\Test\Src\Log;
|
||||
|
||||
use Aternos\Codex\Analyser\PatternAnalyser;
|
||||
use Aternos\Codex\Log\AnalysableLog;
|
||||
use Aternos\Codex\Parser\PatternParser;
|
||||
use Aternos\Codex\Test\Src\Analysis\TestPatternInformation;
|
||||
use Aternos\Codex\Test\Src\Analysis\TestPatternProblem;
|
||||
|
||||
/**
|
||||
* Class TestLog
|
||||
*/
|
||||
class TestPatternLog extends AnalysableLog
|
||||
{
|
||||
/**
|
||||
* Get the default parser
|
||||
*
|
||||
* @return PatternParser
|
||||
*/
|
||||
public static function getDefaultParser(): PatternParser
|
||||
{
|
||||
return (new PatternParser())
|
||||
->setPattern('/(\[([^\]]+)\] \[[^\/]+\/([^\]]+)\]).*/')
|
||||
->setMatches([PatternParser::PREFIX, PatternParser::TIME, PatternParser::LEVEL])
|
||||
->setTimeFormat('d.m.Y H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default analyser
|
||||
*
|
||||
* @return PatternAnalyser
|
||||
*/
|
||||
public static function getDefaultAnalyser(): PatternAnalyser
|
||||
{
|
||||
return (new PatternAnalyser())
|
||||
->addPossibleInsightClass(TestPatternProblem::class)
|
||||
->addPossibleInsightClass(TestPatternInformation::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user