File tree Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,43 @@ public function testGetWithDefault(): void
31
31
public function testLoad (): void
32
32
{
33
33
$ configFile = __DIR__ . '/test_config.php ' ;
34
- file_put_contents ($ configFile , "<?php return ['key' => 'value']; " );
34
+ $ configContent = <<<PHP
35
+ <?php
36
+ return [
37
+ 'default' => 'file',
38
+ 'channels' => [
39
+ 'file' => [
40
+ 'handlers' => ['file'],
41
+ ],
42
+ ],
43
+ 'handlers' => [
44
+ 'file' => [
45
+ 'class' => \KaririCode\Logging\Handler\FileHandler::class,
46
+ 'with' => [
47
+ 'filePath' => '/path/to/logs/file.log',
48
+ ],
49
+ ],
50
+ ],
51
+ 'processors' => [],
52
+ 'formatters' => [
53
+ 'line' => [
54
+ 'class' => \KaririCode\Logging\Formatter\LineFormatter::class,
55
+ 'with' => [
56
+ 'dateFormat' => 'Y-m-d H:i:s',
57
+ ],
58
+ ],
59
+ ],
60
+ ];
61
+ PHP ;
62
+ file_put_contents ($ configFile , $ configContent );
35
63
36
64
$ this ->config ->load ($ configFile );
37
- $ this ->assertEquals ('value ' , $ this ->config ->get ('key ' ));
65
+
66
+ $ this ->assertEquals ('file ' , $ this ->config ->get ('default ' ));
67
+ $ this ->assertIsArray ($ this ->config ->get ('channels ' ));
68
+ $ this ->assertIsArray ($ this ->config ->get ('handlers ' ));
69
+ $ this ->assertIsArray ($ this ->config ->get ('processors ' ));
70
+ $ this ->assertIsArray ($ this ->config ->get ('formatters ' ));
38
71
39
72
unlink ($ configFile );
40
73
}
Original file line number Diff line number Diff line change @@ -25,9 +25,13 @@ class LoggerFactoryTest extends TestCase
25
25
26
26
protected function setUp (): void
27
27
{
28
+ /** @var LoggerConfiguration */
28
29
$ this ->config = $ this ->createMock (LoggerConfiguration::class);
30
+ /** @var LoggerHandlerFactory */
29
31
$ this ->handlerFactory = $ this ->createMock (LoggerHandlerFactory::class);
32
+ /** @var LoggerProcessorFactory */
30
33
$ this ->processorFactory = $ this ->createMock (LoggerProcessorFactory::class);
34
+ /** @var LoggerFormatterFactory */
31
35
$ this ->formatterFactory = $ this ->createMock (LoggerFormatterFactory::class);
32
36
33
37
$ this ->loggerFactory = new LoggerFactory (
@@ -111,10 +115,14 @@ public function testCreateErrorLogger(): void
111
115
112
116
public function testCreateAsyncLogger (): void
113
117
{
118
+ /** @var Logger */
114
119
$ baseLogger = $ this ->createMock (Logger::class);
115
120
$ batchSize = 10 ;
116
121
117
- $ asyncLogger = $ this ->loggerFactory ->createAsyncLogger ($ baseLogger , $ batchSize );
122
+ $ asyncLogger = $ this ->loggerFactory ->createAsyncLogger (
123
+ $ baseLogger ,
124
+ $ batchSize
125
+ );
118
126
119
127
$ this ->assertInstanceOf (AsyncLogger::class, $ asyncLogger );
120
128
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments