public function testKeyCanBeSet() { $key = 'some-key'; $this->assertNull($this->options->getKey()); $this->options->setKey($key); $this->assertEquals($key, $this->options->getKey()); }
/** * {@inheritDoc} * @return ModuleOptions */ public function createService(ServiceLocatorInterface $serviceLocator) { /** @var \Zend\ModuleManager\ModuleManager $moduleManager */ $moduleManager = $serviceLocator->get('ModuleManager'); /** @var \Detail\VarCrypt\Module $module */ $module = $moduleManager->getModule('Detail\\VarCrypt'); if ($module === null) { throw new Exception\ConfigException('Module Detail\\VarCrypt is not loaded'); } $config = $this->getConfig($serviceLocator, $module); if (!isset($config['detail_varcrypt'])) { throw new Exception\ConfigException('Config for Detail\\VarCrypt is not set'); } $moduleOptions = new ModuleOptions($config['detail_varcrypt']); if (!$moduleOptions->getKey()) { throw new Exception\ConfigException('Missing required config option "key" for module Detail\\VarCrypt'); } return $moduleOptions; }