File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 66use DrupalCodeGenerator \ClassResolver \SimpleClassResolver ;
77use DrupalCodeGenerator \GeneratorFactory ;
88use PHPUnit \Framework \TestCase ;
9- use Psr \Log \Test \TestLogger ;
109
1110/**
1211 * Test for GeneratorsDiscovery.
@@ -32,7 +31,12 @@ public function testGetGenerators(): void {
3231 }
3332 self ::assertCount (self ::TOTAL_GENERATORS , $ generators );
3433
35- self ::assertTrue ($ logger ->hasDebugThatMatches ('/^Total generators: {total}/ ' ));
34+ $ log_records [] = [
35+ 'level ' => 'debug ' ,
36+ 'message ' => 'Total generators: {total} ' ,
37+ 'context ' => ['total ' => 15 ],
38+ ];
39+ self ::assertSame ($ log_records , $ logger ->records );
3640 }
3741
3842}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace DrupalCodeGenerator \Tests ;
4+
5+ use Psr \Log \AbstractLogger ;
6+
7+ /**
8+ * Test logger.
9+ */
10+ final class TestLogger extends AbstractLogger {
11+
12+ public array $ records = [];
13+
14+ /**
15+ * {@inheritdoc}
16+ */
17+ public function log ($ level , $ message , array $ context = []) {
18+ $ this ->records [] = [
19+ 'level ' => $ level ,
20+ 'message ' => $ message ,
21+ 'context ' => $ context ,
22+ ];
23+ }
24+
25+ }
You can’t perform that action at this time.
0 commit comments