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