From 6a19124a0970dfd5744c4a193b5d907ba85b323e Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 10 Apr 2017 20:01:10 +0200 Subject: Use raw bytes for upload size hidden input --- tests/UtilsTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/UtilsTest.php') diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index e5ff01e6..d6a0aad5 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -392,13 +392,14 @@ class UtilsTest extends PHPUnit_Framework_TestCase $this->assertEquals('2GiB', human_bytes(strval(2 * (pow(1024, 3))))); $this->assertEquals('374B', human_bytes(374)); $this->assertEquals('374B', human_bytes('374')); + $this->assertEquals('232kiB', human_bytes(237481)); $this->assertEquals('Unlimited', human_bytes('0')); $this->assertEquals('Unlimited', human_bytes(0)); $this->assertEquals('Setting not set', human_bytes('')); } /** - * Test get_max_upload_size + * Test get_max_upload_size with formatting */ public function testGetMaxUploadSize() { @@ -406,4 +407,14 @@ class UtilsTest extends PHPUnit_Framework_TestCase $this->assertEquals('1MiB', get_max_upload_size('1m', '2m')); $this->assertEquals('100B', get_max_upload_size(100, 100)); } + + /** + * Test get_max_upload_size without formatting + */ + public function testGetMaxUploadSizeRaw() + { + $this->assertEquals('1048576', get_max_upload_size(2097152, '1024k', false)); + $this->assertEquals('1048576', get_max_upload_size('1m', '2m', false)); + $this->assertEquals('100', get_max_upload_size(100, 100, false)); + } } -- cgit v1.2.3