public function setUp()
 {
     // setup config provider to fake tests
     $this->initialIniProvider = ConfigurationManager::retrieveProvider('ini');
     // setup fake ini provider to avoid file-based configuration files
     $provider = new FakeIniProvider();
     $config = new IniConfiguration();
     // setup section for action
     $action = new IniConfiguration();
     $action->setValue('ActionClass', PriorityAwareTestAction::class);
     $config->setSection(FrontControllerActionPriorityTest::TEST_ACTION_NAME, $action);
     $provider->registerConfiguration(self::TEST_ACTION_NAMESPACE, self::TEST_ACTION_CONFIG_NAME, $config);
     ConfigurationManager::registerProvider('ini', $provider);
 }
 public function testSavingComplexStructure()
 {
     $config = new IniConfiguration();
     $values = new IniConfiguration();
     $values->setValue('ValueOne', 'foo');
     $values->setValue('ValueTwo', 'bar');
     $subSection = new IniConfiguration();
     $subSection->setSection('SubSection', $values);
     $config->setSection('Section', $subSection);
     ConfigurationManager::saveConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME, $config);
     $storedConfig = ConfigurationManager::loadConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME);
     $this->assertEquals($config->getSection('Section')->getSection('SubSection')->getValue('ValueOne'), $storedConfig->getSection('Section')->getSection('SubSection')->getValue('ValueOne'));
     $this->assertEquals($config->getSection('Section')->getSection('SubSection')->getValue('ValueTwo'), $storedConfig->getSection('Section')->getSection('SubSection')->getValue('ValueTwo'));
     ConfigurationManager::deleteConfiguration(self::TEST_VENDOR, null, null, self::TEST_ENVIRONMENT, self::TEST_NEW_CONFIG_NAME);
 }
 public function testRemoveValueWithPathExpression()
 {
     $config = new IniConfiguration();
     $section = new IniConfiguration();
     $subSection = new IniConfiguration();
     $subSection->setValue('ValueOne', 'foo');
     $subSection->setValue('ValueTwo', 'bar');
     $section->setSection('SubSection', $subSection);
     $config->setSection('Section', $section);
     $this->assertTrue($config->hasValue('Section.SubSection.ValueOne'));
     $this->assertTrue($config->hasValue('Section.SubSection.ValueTwo'));
     $config->removeValue('Section.SubSection.ValueOne');
     $this->assertFalse($config->hasValue('Section.SubSection.ValueOne'));
     $this->assertTrue($config->hasValue('Section.SubSection.ValueTwo'));
 }
 protected function setUp()
 {
     // setup config provider to fake tests
     $this->initialIniProvider = ConfigurationManager::retrieveProvider('ini');
     // setup fake ini provider to avoid file-based configuration files
     $provider = new FakeIniProvider();
     $config = new IniConfiguration();
     // setup section for action
     $action = new IniConfiguration();
     $action->setValue('ActionClass', FilterTestAction::class);
     $config->setSection('say-foo', $action);
     $provider->registerConfiguration('VENDOR\\foo', self::TEST_ACTION_CONFIG_NAME, $config);
     $config->setSection('say-bar', $action);
     $provider->registerConfiguration('VENDOR\\bar', self::TEST_ACTION_CONFIG_NAME, $config);
     $config->setSection('say-baz', $action);
     $provider->registerConfiguration('VENDOR\\baz', self::TEST_ACTION_CONFIG_NAME, $config);
     ConfigurationManager::registerProvider('ini', $provider);
 }