use recent file layout and make this stuff work

This commit is contained in:
2024-09-13 03:22:19 +02:00
parent 30b61b5064
commit 93d2fa6531
5 changed files with 10 additions and 39 deletions

View File

@@ -1,3 +1,6 @@
services: services:
Magdev\RedmineBundle\Client\RedmineClient: Magdev\RedmineBundle\Client\RedmineClient:
arguments: ['@redmine_api.cache', '%env(REDMINE_URL)%', '%env(REDMINE_APIKEY)%', '%magdev_redmine.ttl%'] arguments: ['@redmine_api.cache', '%env(REDMINE_URL)%', '%env(REDMINE_APIKEY)%', '%magdev_redmine.ttl%']
magdev_redmine.client:
class: Magdev\RedmineBundle\Client\RedmineClient

View File

@@ -21,27 +21,6 @@ final class Configuration implements ConfigurationInterface
->end() ->end()
->end(); ->end();
#$rootNode->fixXmlConfig('connection')
# ->children()
# ->arrayNode('connections')
# ->useAttributeAsKey('name')
# ->normalizeKeys(false)
# ->arrayPrototype()
# ->children()
# ->scalarNode('url')
# ->isRequired()
# ->info('Base URL of the Redmine instance')
# ->end()
# ->scalarNode('apikey')
# ->isRequired()
# ->info('Redmine API-Key')
# ->end()
# ->end()
# ->end()
# ->end()
# ->scalarNode('default_connection')->end()
#;
return $treeBuilder; return $treeBuilder;
} }
} }

View File

@@ -19,7 +19,7 @@ final class MagdevRedmineExtension extends Extension
$container->setParameter('magdev_redmine.ttl', $config['ttl']); $container->setParameter('magdev_redmine.ttl', $config['ttl']);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader = new YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/../config'));
$loader->load('services.yaml'); $loader->load('services.yaml');
} }
} }

View File

@@ -17,23 +17,15 @@ class ConfigurationTest extends TestCase
public function testConfig(array $configs): void public function testConfig(array $configs): void
{ {
$config = (new Processor())->processConfiguration(new Configuration(), $configs); $config = (new Processor())->processConfiguration(new Configuration(), $configs);
$this->assertSame('foo', $config['connections']['default']['apikey']); $this->assertSame(1800, $config['ttl']);
$this->assertSame('bar', $config['connections']['default']['url']);
} }
public function configsProvider(): iterable public function configsProvider(): iterable
{ {
yield [ yield [[
[
'magdev_redmine' => [ 'magdev_redmine' => [
'connections' => [ 'ttl' => 1800
'default' => [
'apikey' => 'foo',
'url' => 'bar'
], ],
], ]];
],
],
];
} }
} }

View File

@@ -18,10 +18,7 @@ class MagdevRedmineExtensionTest extends TestCase
(new MagdevRedmineExtension())->load([ (new MagdevRedmineExtension())->load([
'magdev_redmine' => [ 'magdev_redmine' => [
'connections' => [ 'ttl' => 1800,
'primary' => ['url' => 'http://foo1', 'apikey' => 'bar1'],
'secondary' => ['url' => 'http://foo2', 'apikey' => 'bar2'],
],
], ],
], $container); ], $container);