public function testSetConfigurationValueWithEmptyConfiguration() { $this->assertEquals('', $this->configuration->getConfigurationValue('Foo')); $this->assertEquals('', $this->configuration->getConfigurationValue('Foo.Bar.Baz')); $this->assertEquals('', $this->configuration->getConfigurationValue('Foo.Gerrie')); $this->assertEquals('', $this->configuration->getConfigurationValue('Awesome.Application.YOLO')); $this->configuration->setConfigurationValue('Foo', 'Bar'); $this->assertEquals('Bar', $this->configuration->getConfigurationValue('Foo')); $this->configuration->setConfigurationValue('Foo', 'Weekend'); $this->assertEquals('Weekend', $this->configuration->getConfigurationValue('Foo')); $this->configuration->setConfigurationValue('Foo.Bar', 'Baz'); $this->configuration->setConfigurationValue('Foo.Bar.Baz', 'Hello'); $this->configuration->setConfigurationValue('Foo.Gerrie', 'World'); $this->configuration->setConfigurationValue('Awesome.Application.YOLO', 'Google Google Google'); $this->assertEquals(['Baz' => 'Hello'], $this->configuration->getConfigurationValue('Foo.Bar')); $this->assertEquals('Hello', $this->configuration->getConfigurationValue('Foo.Bar.Baz')); $this->assertEquals('World', $this->configuration->getConfigurationValue('Foo.Gerrie')); $this->assertEquals('Google Google Google', $this->configuration->getConfigurationValue('Awesome.Application.YOLO')); }
/** * Merges the command line arguments into a existing configuration. * * E.g. * * Instances * * @param Configuration $config * @param InputExtendedInterface $input * @return Configuration */ protected static function mergeCommandArgumentsIntoConfiguration(Configuration $config, InputExtendedInterface $input) { if ($input->hasArgument('instances') === false) { return $config; } $argumentInstances = $input->getArgument('instances'); if (count($argumentInstances) === 0) { return $config; } // Gerrie is a reserved keyword for project names $config->setConfigurationValue('Gerrit.Gerrie', $argumentInstances); return $config; }