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