diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-10-07 13:59:45 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-10-31 09:32:14 +0100 |
commit | 30dd61eb23d64f26c595ffe5c95d8fc2ee328753 (patch) | |
tree | 68cdd621f2a412a8f9fa062d446f18f76545ea29 | |
parent | 737a50bb2e63911490c78af630e50dfbfb6de25a (diff) |
Disable special handling of {elapsed_time} and {memory_usage}
Documentation says that the variable can be set from the controller,
but it's protected and thus throws and exception. Good documentation is
hard to come by...
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | application/core/MY_Output.php | 16 | ||||
-rw-r--r-- | application/test/tests/test_api_v2.php | 13 | ||||
-rw-r--r-- | data/tests/{elapsed_time}.txt | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/application/core/MY_Output.php b/application/core/MY_Output.php new file mode 100644 index 000000000..402e46c80 --- /dev/null +++ b/application/core/MY_Output.php @@ -0,0 +1,16 @@ +<?php +/* + * Copyright 2016 Florian "Bluewind" Pritz <bluewind@server-speed.net> + * + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ + +class MY_Output extends CI_Output { + public function __construct() + { + parent::__construct(); + $this->parse_exec_vars = false; + } +} diff --git a/application/test/tests/test_api_v2.php b/application/test/tests/test_api_v2.php index b50af4bcf..7335c3bdd 100644 --- a/application/test/tests/test_api_v2.php +++ b/application/test/tests/test_api_v2.php @@ -359,6 +359,19 @@ class test_api_v2 extends \test\Test { $this->t->is($ret["data"]["total_size"], 0, "total_size = 0 since no uploads"); } + public function test_history_specialVarsNotExpanded() + { + $apikey = $this->createUserAndApikey(); + $uploadid = $this->uploadFile($apikey, "data/tests/{elapsed_time}.txt")['data']['ids'][0]; + + $ret = $this->CallEndpoint("POST", "file/history", array( + "apikey" => $apikey, + )); + $this->expectSuccess("get history", $ret); + + $this->t->is($ret["data"]["items"][$uploadid]['filename'], '{elapsed_time}.txt', "{elapsed_time} is not expanded in history reply"); + } + public function test_delete_canDeleteUploaded() { $apikey = $this->createUserAndApikey(); diff --git a/data/tests/{elapsed_time}.txt b/data/tests/{elapsed_time}.txt new file mode 100644 index 000000000..40142d09c --- /dev/null +++ b/data/tests/{elapsed_time}.txt @@ -0,0 +1 @@ +blub |