From 30dd61eb23d64f26c595ffe5c95d8fc2ee328753 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 7 Oct 2016 13:59:45 +0200 Subject: 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 --- application/core/MY_Output.php | 16 ++++++++++++++++ application/test/tests/test_api_v2.php | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 application/core/MY_Output.php (limited to 'application') 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 @@ + + * + * 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(); -- cgit v1.2.3-24-g4f1b