1ed6bf75fSChristopher Smith<?php 2ed6bf75fSChristopher Smith 3ed6bf75fSChristopher Smith/** 4ed6bf75fSChristopher Smith * test wrapper to allow access to private/protected functions/properties 5ed6bf75fSChristopher Smith * 6ed6bf75fSChristopher Smith * NB: for plugin introspection methods, getPluginType() & getPluginName() to work 7ed6bf75fSChristopher Smith * this class name needs to start "admin_" and end "_usermanager". Internally 8ed6bf75fSChristopher Smith * these methods are used in setting up the class, e.g. for language strings 9ed6bf75fSChristopher Smith */ 10ed6bf75fSChristopher Smithclass admin_mock_usermanager extends admin_plugin_usermanager { 11ed6bf75fSChristopher Smith 12ed6bf75fSChristopher Smith public $mock_email_notifications = true; 13ed6bf75fSChristopher Smith public $mock_email_notifications_sent = 0; 14ed6bf75fSChristopher Smith 15*9c9753d6SAndreas Gohr public $localised; 16*9c9753d6SAndreas Gohr public $lang; 17*9c9753d6SAndreas Gohr 18ed6bf75fSChristopher Smith public function getImportFailures() { 19ed6bf75fSChristopher Smith return $this->_import_failures; 20ed6bf75fSChristopher Smith } 21ed6bf75fSChristopher Smith 22ed6bf75fSChristopher Smith public function tryExport() { 23ed6bf75fSChristopher Smith ob_start(); 24ed6bf75fSChristopher Smith $this->_export(); 25ed6bf75fSChristopher Smith return ob_get_clean(); 26ed6bf75fSChristopher Smith } 27ed6bf75fSChristopher Smith 28ed6bf75fSChristopher Smith public function tryImport() { 29ed6bf75fSChristopher Smith return $this->_import(); 30ed6bf75fSChristopher Smith } 31ed6bf75fSChristopher Smith 32ed6bf75fSChristopher Smith // no need to send email notifications (mostly) 33ed6bf75fSChristopher Smith protected function _notifyUser($user, $password, $status_alert=true) { 34ed6bf75fSChristopher Smith if ($this->mock_email_notifications) { 35ed6bf75fSChristopher Smith $this->mock_email_notifications_sent++; 36ed6bf75fSChristopher Smith return true; 37ed6bf75fSChristopher Smith } else { 38ed6bf75fSChristopher Smith return parent::_notifyUser($user, $password, $status_alert); 39ed6bf75fSChristopher Smith } 40ed6bf75fSChristopher Smith } 41ed6bf75fSChristopher Smith 42ed6bf75fSChristopher Smith protected function _isUploadedFile($file) { 43ed6bf75fSChristopher Smith return file_exists($file); 44ed6bf75fSChristopher Smith } 45ed6bf75fSChristopher Smith} 46ed6bf75fSChristopher Smith 47211955beSChristopher Smithclass auth_mock_authplain extends auth_plugin_authplain { 48211955beSChristopher Smith 49211955beSChristopher Smith public function setCanDo($op, $canDo) { 50211955beSChristopher Smith $this->cando[$op] = $canDo; 51211955beSChristopher Smith } 52211955beSChristopher Smith 53211955beSChristopher Smith} 54