diff options
author | Fabian Henze <flyser42@gmx.de> | 2014-04-07 15:31:34 +0200 |
---|---|---|
committer | Fabian Henze <flyser42@gmx.de> | 2014-04-07 15:31:34 +0200 |
commit | 1245ff8f318fafd66eed1ba8f9f2b3755aa537ca (patch) | |
tree | 08a0a028c3f72fd6215ee57295b6e50cfbb8e59d | |
parent | 7cdb16979a6c7e75b71dd8c7c5b39b6482041fb8 (diff) | |
download | nextcloud-server-1245ff8f318fafd66eed1ba8f9f2b3755aa537ca.tar.gz nextcloud-server-1245ff8f318fafd66eed1ba8f9f2b3755aa537ca.zip |
Add unit tests for OC_Helper::phpFileSize function
-rw-r--r-- | tests/lib/helper.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/helper.php b/tests/lib/helper.php index 0943e6bc1b9..7177570d67f 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -31,6 +31,28 @@ class Test_Helper extends PHPUnit_Framework_TestCase { } /** + * @dataProvider phpFileSizeProvider + */ + public function testPhpFileSize($expected, $input) + { + $result = OC_Helper::phpFileSize($input); + $this->assertEquals($expected, $result); + } + + public function phpFileSizeProvider() + { + return array( + array('0B', 0), + array('1K', 1024), + array('9.5M', 10000000), + array('1.3G', 1395864371), + array('465.7G', 500000000000), + array('465661.3G', 500000000000000), + array('465661287.3G', 500000000000000000), + ); + } + + /** * @dataProvider computerFileSizeProvider */ function testComputerFileSize($expected, $input) { |