File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Aternos \Codex \Test \Tests \Detector ;
4+
5+ use Aternos \Codex \Detective \MultiPatternDetector ;
6+ use Aternos \Codex \Log \File \StringLogFile ;
7+ use PHPUnit \Framework \TestCase ;
8+
9+ class MultiPatternDetectorTest extends TestCase
10+ {
11+ public function testDetectSinglePattern (): void
12+ {
13+ $ this ->assertTrue ((new MultiPatternDetector ())
14+ ->setLogFile (new StringLogFile ("You can detect this. " ))
15+ ->addPattern ('/detect/ ' )
16+ ->detect ()
17+ );
18+ }
19+
20+ public function testDetectMultiplePatterns (): void
21+ {
22+ $ this ->assertTrue ((new MultiPatternDetector ())
23+ ->setLogFile (new StringLogFile ("You can detect this and this. " ))
24+ ->addPattern ('/detect/ ' )
25+ ->addPattern ('/and this/ ' )
26+ ->detect ()
27+ );
28+ }
29+
30+ public function testNotDetectMissingFromMultiplePatterns (): void
31+ {
32+ $ this ->assertFalse ((new MultiPatternDetector ())
33+ ->setLogFile (new StringLogFile ("You can detect this and this. " ))
34+ ->addPattern ('/detect/ ' )
35+ ->addPattern ('/and this/ ' )
36+ ->addPattern ('/but not this/ ' )
37+ ->detect ()
38+ );
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments