diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-11-16 08:20:58 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-11-16 14:56:15 +0100 |
commit | 4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf (patch) | |
tree | b051f6eb0e2b07c2f5b8b21143efcc91ff6de0c5 /tests | |
parent | 09c8c58a5c9602a665519586b75ae3e9831367c8 (diff) | |
download | forums-4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf.tar forums-4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf.tar.gz forums-4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf.tar.bz2 forums-4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf.tar.xz forums-4e3a42f59fa32fb1a3e14cff959b19576e5ba7cf.zip |
[ticket/11192] Test strings not converted to int/float before.
PHPBB3-11192
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functions/get_formatted_filesize_test.php | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/tests/functions/get_formatted_filesize_test.php b/tests/functions/get_formatted_filesize_test.php index 85b06b723d..88866f90ac 100644 --- a/tests/functions/get_formatted_filesize_test.php +++ b/tests/functions/get_formatted_filesize_test.php @@ -45,6 +45,40 @@ class phpbb_get_formatted_filesize_test extends phpbb_test_case ); } + public function get_formatted_filesize_test_data_string() + { + return array( + // exact powers of 2 + array('1', '1 BYTES'), + array('1024', '1 KIB'), + array('1048576', '1 MIB'), + array('1073741824', '1 GIB'), + array('1099511627776', '1 TIB'), + + // exact powers of 10 + array('1000', '1000 BYTES'), + array('1000000', '976.56 KIB'), + array('1000000000', '953.67 MIB'), + array('1000000000000', '931.32 GIB'), + array('100000000000000', '90.95 TIB'), + + array('0', '0 BYTES'), + array('2', '2 BYTES'), + array('-2', '-2 BYTES'), + + array('1023', '1023 BYTES'), + array('1025', '1 KIB'), + array('-1023', '-1023 BYTES'), + array('-1025', '-1025 BYTES'), + + array('1048575', '1024 KIB'), + + // large negatives + array('-1073741824', '-1073741824 BYTES'), + array('-1099511627776', '-1099511627776 BYTES'), + ); + } + /** * @dataProvider get_formatted_filesize_test_data */ @@ -56,11 +90,11 @@ class phpbb_get_formatted_filesize_test extends phpbb_test_case } /** - * @dataProvider get_formatted_filesize_test_data + * @dataProvider get_formatted_filesize_test_data_string */ public function test_get_formatted_filesize_string($input, $expected) { - $output = get_formatted_filesize("$input"); + $output = get_formatted_filesize($input); $this->assertEquals($expected, $output); } |