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