Merge "Add tests for case-(in)sensitive magic words"
[lhc/web/wiklou.git] / tests / phpunit / includes / GlobalFunctions / wfShorthandToIntegerTest.php
1 <?php
2
3 class WfShorthandToIntegerTest extends MediaWikiTestCase {
4 /**
5 * @dataProvider provideABunchOfShorthands
6 */
7 function testWfShorthandToInteger( $input, $output, $description ) {
8 $this->assertEquals(
9 wfShorthandToInteger( $input ),
10 $output,
11 $description
12 );
13 }
14
15 public static function provideABunchOfShorthands() {
16 return array(
17 array( '', -1, 'Empty string' ),
18 array( ' ', -1, 'String of spaces' ),
19 array( '1G', 1024 * 1024 * 1024, 'One gig uppercased' ),
20 array( '1g', 1024 * 1024 * 1024, 'One gig lowercased' ),
21 array( '1M', 1024 * 1024, 'One meg uppercased' ),
22 array( '1m', 1024 * 1024, 'One meg lowercased' ),
23 array( '1K', 1024, 'One kb uppercased' ),
24 array( '1k', 1024, 'One kb lowercased' ),
25 );
26 }
27
28 }