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