aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-04-10 20:01:10 +0200
committerArthurHoaro <arthur@hoa.ro>2017-04-10 20:01:10 +0200
commit6a19124a0970dfd5744c4a193b5d907ba85b323e (patch)
treead886ea19ba4d38cea43ad52faf264da0383db58 /tests
parentc8cb5c282402e3f19497ba9e57ac967a4bdefa1b (diff)
downloadShaarli-6a19124a0970dfd5744c4a193b5d907ba85b323e.tar.gz
Shaarli-6a19124a0970dfd5744c4a193b5d907ba85b323e.tar.zst
Shaarli-6a19124a0970dfd5744c4a193b5d907ba85b323e.zip
Use raw bytes for upload size hidden input
Diffstat (limited to 'tests')
-rw-r--r--tests/UtilsTest.php13
1 files changed, 12 insertions, 1 deletions
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
392 $this->assertEquals('2GiB', human_bytes(strval(2 * (pow(1024, 3))))); 392 $this->assertEquals('2GiB', human_bytes(strval(2 * (pow(1024, 3)))));
393 $this->assertEquals('374B', human_bytes(374)); 393 $this->assertEquals('374B', human_bytes(374));
394 $this->assertEquals('374B', human_bytes('374')); 394 $this->assertEquals('374B', human_bytes('374'));
395 $this->assertEquals('232kiB', human_bytes(237481));
395 $this->assertEquals('Unlimited', human_bytes('0')); 396 $this->assertEquals('Unlimited', human_bytes('0'));
396 $this->assertEquals('Unlimited', human_bytes(0)); 397 $this->assertEquals('Unlimited', human_bytes(0));
397 $this->assertEquals('Setting not set', human_bytes('')); 398 $this->assertEquals('Setting not set', human_bytes(''));
398 } 399 }
399 400
400 /** 401 /**
401 * Test get_max_upload_size 402 * Test get_max_upload_size with formatting
402 */ 403 */
403 public function testGetMaxUploadSize() 404 public function testGetMaxUploadSize()
404 { 405 {
@@ -406,4 +407,14 @@ class UtilsTest extends PHPUnit_Framework_TestCase
406 $this->assertEquals('1MiB', get_max_upload_size('1m', '2m')); 407 $this->assertEquals('1MiB', get_max_upload_size('1m', '2m'));
407 $this->assertEquals('100B', get_max_upload_size(100, 100)); 408 $this->assertEquals('100B', get_max_upload_size(100, 100));
408 } 409 }
410
411 /**
412 * Test get_max_upload_size without formatting
413 */
414 public function testGetMaxUploadSizeRaw()
415 {
416 $this->assertEquals('1048576', get_max_upload_size(2097152, '1024k', false));
417 $this->assertEquals('1048576', get_max_upload_size('1m', '2m', false));
418 $this->assertEquals('100', get_max_upload_size(100, 100, false));
419 }
409} 420}