From: Sam Reed Date: Sat, 31 Dec 2011 02:13:59 +0000 (+0000) Subject: Add some tests for formatSize X-Git-Tag: 1.31.0-rc.0~25662 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=fa9efe332dbdc74427e2034d7416a375bcf0a1aa;p=lhc%2Fweb%2Fwiklou.git Add some tests for formatSize --- diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index 401e5a3703..918f931ae3 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -1,6 +1,10 @@ assertEquals( + $expected, + $this->lang->formatSize( $size ), + "formatSize('$size'): $msg" + ); + } + + function provideFormatSizes() { + return array( + array( + 0, + "0 B", + "Zero bytes" + ), + array( + 1024, + "1,024 B", + "1,024 bytes" + ), + array( + 1024 + 1, + "1 KB", + "1 kilobyte" + ), + array( + 1024 * 1024, + "1,024 KB", + "1,024 kilobyte" + ), + array( + ( 1024 * 1024 ) + 1, + "1 MB", + "1 megabyte" + ), + array( + 1024 * 1024 * 1024, + "1,024 MB", + "1,024 megabyte" + ), + array( + ( 1024 * 1024 * 1024 ) + 1, + "1 GB", + "1 gigabyte" + ), + array( + ( 1024 * 1024 * 1024 * 1024 ) + 1, + "1,024 GB", + "1,024 gigabyte" + ), + ); + } }