Also split 2 tests off into their correct test classes, this methods are clearly no longer global functions Change-Id: I482433f3099e72507a766e85d9576ff36e58b9ad
30 lines
811 B
PHP
30 lines
811 B
PHP
<?php
|
|
|
|
/**
|
|
* @covers ::wfShorthandToInteger
|
|
*/
|
|
class WfShorthandToIntegerTest extends MediaWikiTestCase {
|
|
/**
|
|
* @dataProvider provideABunchOfShorthands
|
|
*/
|
|
public function testWfShorthandToInteger( $input, $output, $description ) {
|
|
$this->assertEquals(
|
|
wfShorthandToInteger( $input ),
|
|
$output,
|
|
$description
|
|
);
|
|
}
|
|
|
|
public static function provideABunchOfShorthands() {
|
|
return array(
|
|
array( '', -1, 'Empty string' ),
|
|
array( ' ', -1, 'String of spaces' ),
|
|
array( '1G', 1024 * 1024 * 1024, 'One gig uppercased' ),
|
|
array( '1g', 1024 * 1024 * 1024, 'One gig lowercased' ),
|
|
array( '1M', 1024 * 1024, 'One meg uppercased' ),
|
|
array( '1m', 1024 * 1024, 'One meg lowercased' ),
|
|
array( '1K', 1024, 'One kb uppercased' ),
|
|
array( '1k', 1024, 'One kb lowercased' ),
|
|
);
|
|
}
|
|
}
|