diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-04-25 19:03:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 19:03:29 +0200 |
commit | 504c9df4e7ed126678f146d4c349c798b8338407 (patch) | |
tree | ad886ea19ba4d38cea43ad52faf264da0383db58 /tests/UtilsTest.php | |
parent | c8cb5c282402e3f19497ba9e57ac967a4bdefa1b (diff) | |
parent | 6a19124a0970dfd5744c4a193b5d907ba85b323e (diff) | |
download | Shaarli-504c9df4e7ed126678f146d4c349c798b8338407.tar.gz Shaarli-504c9df4e7ed126678f146d4c349c798b8338407.tar.zst Shaarli-504c9df4e7ed126678f146d4c349c798b8338407.zip |
Merge pull request #848 from ArthurHoaro/hotfix/upload-maxsize
Use raw bytes for upload size hidden input
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 13 |
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 | } |