From 41ffa1d7c213e39f216304a48aea2b8c19a6cf68 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 14 Feb 2014 12:11:49 +0100 Subject: [PATCH] Fix PHP Fatal error: Class 'Icinga\Authentication\Membership' not found in ManagerTest.php --- library/Icinga/Authentication/Manager.php | 26 ++++++------------- .../Icinga/Authentication/ManagerTest.php | 7 ++--- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php index 2ce0932f2..05ae84d70 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Manager.php @@ -89,39 +89,29 @@ class Manager /** * Creates a new authentication manager using the provided config (or the - * configuration provided in the authentication.ini if no config is given) - * and with the given options. + * configuration provided in the authentication.ini if no config is given). * * @param Zend_Config $config The configuration to use for authentication * instead of the authentication.ini - * @param array $options Additional options that affect the managers behaviour. - * Supported values: - * * noDefaultConfig: Disable default configuration from authentication.ini **/ - private function __construct(Zend_Config $config = null, array $options = array()) + private function __construct(Zend_Config $config = null) { - if ($config === null && !(isset($options['noDefaultConfig']) && $options['noDefaultConfig'] == true)) { - $config = IcingaConfig::app('authentication'); - } - - if ($config !== null) { - $this->setupBackends($config); - } + $this->config = $config === null ? IcingaConfig::app('authentication') : $config; + $this->setupBackends($this->config); } /** - * Get a singleton instance of our self + * Get the authentication manager * - * @param Zend_Config $config - * @param array $options + * @param Zend_Config $config * * @return self * @see Manager:__construct */ - public static function getInstance(Zend_Config $config = null, array $options = array()) + public static function getInstance(Zend_Config $config = null) { if (self::$instance === null) { - self::$instance = new Manager($config, $options); + self::$instance = new static($config); } return self::$instance; } diff --git a/test/php/library/Icinga/Authentication/ManagerTest.php b/test/php/library/Icinga/Authentication/ManagerTest.php index 4afd882f1..1aee7e50f 100644 --- a/test/php/library/Icinga/Authentication/ManagerTest.php +++ b/test/php/library/Icinga/Authentication/ManagerTest.php @@ -42,6 +42,7 @@ require_once 'Zend/Config.php'; require_once BaseTestCase::$libDir . '/Application/Logger.php'; require_once BaseTestCase::$libDir . '/Authentication/Manager.php'; require_once BaseTestCase::$libDir . '/Authentication/Credential.php'; +require_once BaseTestCase::$libDir . '/Authentication/Membership.php'; require_once BaseTestCase::$libDir . '/Exception/ConfigurationError.php'; require_once BaseTestCase::$libDir . '/Exception/ProgrammingError.php'; require_once BaseTestCase::$libDir . '/Web/Session.php'; @@ -84,12 +85,8 @@ class ManagerTest extends BaseTestCase $managerConfig = new Zend_Config(array()); } - $managerOptions = array( - 'noDefaultConfig' => true - ); - Session::create($session); - $manager = AuthManager::getInstance($managerConfig, $managerOptions); + $manager = AuthManager::getInstance($managerConfig); if ($nobackend === false) { $backend = new BackendMock();