MediaWiki REL1_30
MonologSpiTest.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Logger;
22
24use Wikimedia\TestingAccessWrapper;
25
27
31 public function testMergeConfig() {
32 $base = [
33 'loggers' => [
34 '@default' => [
35 'processors' => [ 'constructor' ],
36 'handlers' => [ 'constructor' ],
37 ],
38 ],
39 'processors' => [
40 'constructor' => [
41 'class' => 'constructor',
42 ],
43 ],
44 'handlers' => [
45 'constructor' => [
46 'class' => 'constructor',
47 'formatter' => 'constructor',
48 ],
49 ],
50 'formatters' => [
51 'constructor' => [
52 'class' => 'constructor',
53 ],
54 ],
55 ];
56
57 $fixture = new MonologSpi( $base );
58 $this->assertSame(
59 $base,
60 TestingAccessWrapper::newFromObject( $fixture )->config
61 );
62
63 $fixture->mergeConfig( [
64 'loggers' => [
65 'merged' => [
66 'processors' => [ 'merged' ],
67 'handlers' => [ 'merged' ],
68 ],
69 ],
70 'processors' => [
71 'merged' => [
72 'class' => 'merged',
73 ],
74 ],
75 'magic' => [
76 'idkfa' => [ 'xyzzy' ],
77 ],
78 'handlers' => [
79 'merged' => [
80 'class' => 'merged',
81 'formatter' => 'merged',
82 ],
83 ],
84 'formatters' => [
85 'merged' => [
86 'class' => 'merged',
87 ],
88 ],
89 ] );
90 $this->assertSame(
91 [
92 'loggers' => [
93 '@default' => [
94 'processors' => [ 'constructor' ],
95 'handlers' => [ 'constructor' ],
96 ],
97 'merged' => [
98 'processors' => [ 'merged' ],
99 'handlers' => [ 'merged' ],
100 ],
101 ],
102 'processors' => [
103 'constructor' => [
104 'class' => 'constructor',
105 ],
106 'merged' => [
107 'class' => 'merged',
108 ],
109 ],
110 'handlers' => [
111 'constructor' => [
112 'class' => 'constructor',
113 'formatter' => 'constructor',
114 ],
115 'merged' => [
116 'class' => 'merged',
117 'formatter' => 'merged',
118 ],
119 ],
120 'formatters' => [
121 'constructor' => [
122 'class' => 'constructor',
123 ],
124 'merged' => [
125 'class' => 'merged',
126 ],
127 ],
128 'magic' => [
129 'idkfa' => [ 'xyzzy' ],
130 ],
131 ],
132 TestingAccessWrapper::newFromObject( $fixture )->config
133 );
134 }
135
136}
testMergeConfig()
MediaWiki\Logger\MonologSpi::mergeConfig.
LoggerFactory service provider that creates loggers implemented by Monolog.