Remove '@section LICENSE'
[lhc/web/wiklou.git] / tests / phpunit / includes / debug / logging / legacy / LoggerTest.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 class MWLoggerLegacyLoggerTest extends MediaWikiTestCase {
22
23 /**
24 * @covers MWLoggerLegacyLogger::interpolate
25 * @dataProvider provideInterpolate
26 */
27 public function testInterpolate( $message, $context, $expect ) {
28 $this->assertEquals(
29 $expect, MWLoggerLegacyLogger::interpolate( $message, $context ) );
30 }
31
32 public function provideInterpolate() {
33 return array(
34 array(
35 'no-op',
36 array(),
37 'no-op',
38 ),
39 array(
40 'Hello {world}!',
41 array(
42 'world' => 'World',
43 ),
44 'Hello World!',
45 ),
46 array(
47 '{greeting} {user}',
48 array(
49 'greeting' => 'Goodnight',
50 'user' => 'Moon',
51 ),
52 'Goodnight Moon',
53 ),
54 array(
55 'Oops {key_not_set}',
56 array(),
57 'Oops {key_not_set}',
58 ),
59 array(
60 '{ not interpolated }',
61 array(
62 'not interpolated' => 'This should NOT show up in the message',
63 ),
64 '{ not interpolated }',
65 ),
66 );
67 }
68
69 }