bad8d8d5cc37ceeb6f97dcefc728c2aeb00024f1
[lhc/web/wiklou.git] / tests / phpunit / includes / debug / logging / legacy / LoggerTest.php
1 <?php
2 /**
3 * @section LICENSE
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
18 *
19 * @file
20 */
21
22 class MWLoggerLegacyLoggerTest extends MediaWikiTestCase {
23
24 /**
25 * @covers MWLoggerLegacyLogger::interpolate
26 * @dataProvider provideInterpolate
27 */
28 public function testInterpolate( $message, $context, $expect ) {
29 $this->assertEquals(
30 $expect, MWLoggerLegacyLogger::interpolate( $message, $context ) );
31 }
32
33 public function provideInterpolate() {
34 return array(
35 array(
36 'no-op',
37 array(),
38 'no-op',
39 ),
40 array(
41 'Hello {world}!',
42 array(
43 'world' => 'World',
44 ),
45 'Hello World!',
46 ),
47 array(
48 '{greeting} {user}',
49 array(
50 'greeting' => 'Goodnight',
51 'user' => 'Moon',
52 ),
53 'Goodnight Moon',
54 ),
55 array(
56 'Oops {key_not_set}',
57 array(),
58 'Oops {key_not_set}',
59 ),
60 array(
61 '{ not interpolated }',
62 array(
63 'not interpolated' => 'This should NOT show up in the message',
64 ),
65 '{ not interpolated }',
66 ),
67 );
68 }
69
70 }