Merge "Don't check namespace in SpecialWantedtemplates"
[lhc/web/wiklou.git] / tests / phpunit / includes / debug / logger / MonologSpiTest.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21 namespace MediaWiki\Logger;
22
23 use MediaWikiTestCase;
24 use TestingAccessWrapper;
25
26 class MonologSpiTest extends MediaWikiTestCase {
27
28 /**
29 * @covers MonologSpi::mergeConfig
30 */
31 public function testMergeConfig() {
32 $base = array(
33 'loggers' => array(
34 '@default' => array(
35 'processors' => array( 'constructor' ),
36 'handlers' => array( 'constructor' ),
37 ),
38 ),
39 'processors' => array(
40 'constructor' => array(
41 'class' => 'constructor',
42 ),
43 ),
44 'handlers' => array(
45 'constructor' => array(
46 'class' => 'constructor',
47 'formatter' => 'constructor',
48 ),
49 ),
50 'formatters' => array(
51 'constructor' => array(
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( array(
64 'loggers' => array(
65 'merged' => array(
66 'processors' => array( 'merged' ),
67 'handlers' => array( 'merged' ),
68 ),
69 ),
70 'processors' => array(
71 'merged' => array(
72 'class' => 'merged',
73 ),
74 ),
75 'magic' => array(
76 'idkfa' => array( 'xyzzy' ),
77 ),
78 'handlers' => array(
79 'merged' => array(
80 'class' => 'merged',
81 'formatter' => 'merged',
82 ),
83 ),
84 'formatters' => array(
85 'merged' => array(
86 'class' => 'merged',
87 ),
88 ),
89 ) );
90 $this->assertSame(
91 array(
92 'loggers' => array(
93 '@default' => array(
94 'processors' => array( 'constructor' ),
95 'handlers' => array( 'constructor' ),
96 ),
97 'merged' => array(
98 'processors' => array( 'merged' ),
99 'handlers' => array( 'merged' ),
100 ),
101 ),
102 'processors' => array(
103 'constructor' => array(
104 'class' => 'constructor',
105 ),
106 'merged' => array(
107 'class' => 'merged',
108 ),
109 ),
110 'handlers' => array(
111 'constructor' => array(
112 'class' => 'constructor',
113 'formatter' => 'constructor',
114 ),
115 'merged' => array(
116 'class' => 'merged',
117 'formatter' => 'merged',
118 ),
119 ),
120 'formatters' => array(
121 'constructor' => array(
122 'class' => 'constructor',
123 ),
124 'merged' => array(
125 'class' => 'merged',
126 ),
127 ),
128 'magic' => array(
129 'idkfa' => array( 'xyzzy' ),
130 ),
131 ),
132 TestingAccessWrapper::newFromObject( $fixture )->config
133 );
134 }
135
136 }