summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2013-01-21 10:45:34 +0100
committershadlaws <shad@shadlaws.com>2013-01-21 10:45:34 +0100
commit8436e16b2f2fe398be22e59110a907e7554cac90 (patch)
tree348fcfc2fa4913cdfd1ce649d025a03c668df3d9 /modules/gallery/helpers
parentd45a73777935c86fc5131955831833d7465b5e9d (diff)
#1954 - Skip buffer calls for unit tests of file_proxy and data_rest.
Moved the "if (TEST_MODE)" statement before the buffer calls in file_proxy and data_rest. This has no impact on normal use, but will make the unit tests more compatible with different server/PHP configurations. Note: We do not have to skip setting the headers, which means we can build unit tests around them if we wish.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/data_rest.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php
index 8a3a159d..dc213510 100644
--- a/modules/gallery/helpers/data_rest.php
+++ b/modules/gallery/helpers/data_rest.php
@@ -57,13 +57,14 @@ class data_rest_Core {
} else {
header("Content-Type: $item->mime_type");
}
- Kohana::close_buffers(false);
- if (isset($p->encoding) && $p->encoding == "base64") {
- print base64_encode(file_get_contents($file));
+ if (TEST_MODE) {
+ return $file;
} else {
- if (TEST_MODE) {
- return $file;
+ Kohana::close_buffers(false);
+
+ if (isset($p->encoding) && $p->encoding == "base64") {
+ print base64_encode(file_get_contents($file));
} else {
readfile($file);
}