wiki.techinc.nl/tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php
Max Semenik d28fd40189 Mark relevant tests with @group GlobalFunctions
Change-Id: I4133ad7e5e042a8c24d4836ae2bf9f1880a56e70
2014-07-20 23:36:10 +00:00

31 lines
837 B
PHP

<?php
/**
* @group GlobalFunctions
* @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' ),
);
}
}