/** * {@inheritDoc} * @return RoleProviderPluginManager */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config')['zfc_rbac']['role_provider_manager']; $pluginManager = new RoleProviderPluginManager(new Config($config)); $pluginManager->setServiceLocator($serviceLocator); return $pluginManager; }
/** * This is required due to the fact that the ServiceManager catches ALL exceptions and throws it's own... */ public function testThrowExceptionIfNoObjectManagerNorObjectRepositoryIsSet() { try { $serviceManager = new ServiceManager(); $pluginManager = new RoleProviderPluginManager($serviceManager); $pluginManager->get('ZfcRbac\\Role\\ObjectRepositoryRoleProvider', ['role_name_property' => 'name']); } catch (ServiceNotCreatedException $smException) { while ($e = $smException->getPrevious()) { if ($e instanceof RuntimeException) { return true; } } } $this->fail('ZfcRbac\\Factory\\ObjectRepositoryRoleProviderFactory::createService() :: ' . 'ZfcRbac\\Exception\\RuntimeException was not found in the previous Exceptions'); }
public function testValidationOfPluginFailsIfRoleProviderInterfaceIsNotImplemented() { $this->setExpectedException('ZfcRbac\\Exception\\RuntimeException'); $pluginManager = new RoleProviderPluginManager(); $pluginManager->get('stdClass', []); }