summaryrefslogtreecommitdiffstats
path: root/application/test/tests/test_filebin_helper.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-02-01 21:49:32 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-02-01 21:49:32 +0100
commit15cbce87704b9f3f1b2aaddb4136d5e76a46a4ce (patch)
treea1df2a2efa8b09424418ce72237a8922cf81dee5 /application/test/tests/test_filebin_helper.php
parent111cd0fe83721506e438b4125a42d6cb0cf28809 (diff)
return_bytes(): Throw exception on unhandled unit type
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/test/tests/test_filebin_helper.php')
-rw-r--r--application/test/tests/test_filebin_helper.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/application/test/tests/test_filebin_helper.php b/application/test/tests/test_filebin_helper.php
index c505dfe8a..2069f2953 100644
--- a/application/test/tests/test_filebin_helper.php
+++ b/application/test/tests/test_filebin_helper.php
@@ -65,7 +65,13 @@ class test_filebin_helper extends \test\Test {
$this->t->is(return_bytes("1k"), 1*1024, "1k");
$this->t->is(return_bytes("1M"), 1*1024*1024, "1M");
$this->t->is(return_bytes("1G"), 1*1024*1024*1024, "1G");
- $this->t->is(return_bytes("1P"), "1P", "unhandled text: 1P");
- $this->t->ok(return_bytes("106954752") === 106954752, "value without unit is returned as int");
+
+ try {
+ return_bytes("1P");
+ } catch (\exceptions\ApiException $e) {
+ $this->t->is($e->get_error_id(), 'filebin-helper/invalid-input-unit', "unhandled text: 1P");
+ }
+
+ $this->t->is(return_bytes("106954752"), 106954752, "value without unit is returned as int");
}
}