public function testGetEmptySettingsWhenNoSettingsIsAvailable()
 {
     $cacheOptions = new CacheOptions();
     $options = new ModuleOptions(['cache_options' => $cacheOptions]);
     $settingsMapper = $this->getMock('HtSettingsModule\\Mapper\\SettingsMapperInterface');
     $namespaceHydratorProvider = $this->getMockBuilder('HtSettingsModule\\Service\\NamespaceHydratorProviderInerface')->disableOriginalConstructor()->getMock();
     $settingsProvider = new SettingsProvider($options, $settingsMapper, $namespaceHydratorProvider);
     $namespaceOptions = new NamespaceOptions(['entity_class' => 'ArrayObject', 'hydrator' => new Hydrator\ArraySerializable()]);
     $options->addNamespace($namespaceOptions, 'hockey');
     $settingsMapper->expects($this->any())->method('findByNamespace')->will($this->returnValue([]));
     $settings = $settingsProvider->getSettings('hockey');
 }
 public function testAddNamespace()
 {
     $options = new ModuleOptions();
     $options->addNamespace(['name' => 'laptop', 'entity_class' => 'HtSettingsModule\\Entity\\Parameter']);
     $options->addNamespace([], 'smart_phone');
     $options->addNamespace(new NamespaceOptions(), 'smart_tv');
     $this->assertEquals('laptop', $options->getNamespaceOptions('laptop')->getName());
     $this->assertEquals('smart_phone', $options->getNamespaceOptions('smart_phone')->getName());
     $this->assertEquals('smart_tv', $options->getNamespaceOptions('smart_tv')->getName());
 }
 public function testDetectionNamespace()
 {
     $options = new ModuleOptions();
     $settingsMapper = $this->getMock('HtSettingsModule\\Mapper\\SettingsMapperInterface');
     $settingsService = new SettingsService($options, $settingsMapper, $this->getMock('HtSettingsModule\\Service\\NamespaceHydratorProviderInerface'));
     $options->addNamespace(['entity_class' => 'HtSettingsModuleTest\\Model\\Theme'], 'theme');
     $options->addNamespace(['entity_class' => 'ArrayObject'], 'network');
     $reflectionMethod = new \ReflectionMethod($settingsService, 'detectNamespace');
     $reflectionMethod->setAccessible(true);
     $this->assertEquals('network', $reflectionMethod->invokeArgs($settingsService, [new ArrayObject()]));
     $this->assertEquals('theme', $reflectionMethod->invokeArgs($settingsService, [new Theme()]));
     $this->setExpectedException('HtSettingsModule\\Exception\\InvalidArgumentException');
     $this->assertEquals('theme', $reflectionMethod->invokeArgs($settingsService, [new \stdClass()]));
 }