summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2013-11-28 00:08:52 +0000
committerChristopher Smith <chris@jalakai.co.uk>2013-11-28 00:08:52 +0000
commitb2c01466e61a7800306d8705eada83563ca90a55 (patch)
tree0ddf54cb47233e4d189367c9437ae4566f95cbe0 /lib
parent5ba64050580b6936c8b364e3a288e7c875263c88 (diff)
downloadrpg-b2c01466e61a7800306d8705eada83563ca90a55.tar.gz
rpg-b2c01466e61a7800306d8705eada83563ca90a55.tar.bz2
Improvements to facilitate unit testing
- don't die at end of _export() - internal classs wrapper method for is_uploaded_file() to allow overriding for use under cli & without having to upload a file
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/usermanager/admin.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php
index 2c566723a..782443ee1 100644
--- a/lib/plugins/usermanager/admin.php
+++ b/lib/plugins/usermanager/admin.php
@@ -814,6 +814,8 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
fputcsv($fd, $line);
}
fclose($fd);
+ if (defined('DOKU_UNITTEST')){ return; }
+
die;
}
@@ -830,7 +832,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
if (!$this->_auth->canDo('addUser')) return false;
// check file uploaded ok.
- if (empty($_FILES['import']['size']) || !empty($_FILES['import']['error']) && is_uploaded_file($_FILES['import']['tmp_name'])) {
+ if (empty($_FILES['import']['size']) || !empty($_FILES['import']['error']) && $this->_isUploadedFile($_FILES['import']['tmp_name'])) {
msg($this->lang['import_error_upload'],-1);
return false;
}
@@ -974,4 +976,11 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
die;
}
+ /**
+ * wrapper for is_uploaded_file to facilitate overriding by test suite
+ */
+ protected function _isUploadedFile($file) {
+ return is_uploaded_file($file);
+ }
+
}