Skip to content

Commit

Permalink
Rollback to the actual service id as a snake-case version (#35)
Browse files Browse the repository at this point in the history
* Rollback to the actual service id as a snake-case version

This really should have been done in the other direction: we typically make the actual service id the snake-case version and then create an alias for the autowiring.

* Fix tests
  • Loading branch information
bocharsky-bw authored and soullivaneuh committed Jan 6, 2020
1 parent 7c99a99 commit bc550d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Resources/config/client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Nexy\Slack\Client" public="true">
<service id="nexy_slack.client" class="Nexy\Slack\Client" public="true">
<argument type="service" id="nexy_slack.http.client" />
<argument type="service" id="nexy_slack.http.request_factory" />
<argument type="service" id="nexy_slack.http.stream_factory" />
<argument>%nexy_slack.endpoint%</argument>
<argument>%nexy_slack.config%</argument>
</service>

<service id="nexy_slack.client" alias="Nexy\Slack\Client"/>
<service id="Nexy\Slack\Client" alias="nexy_slack.client"/>

<service id="nexy_slack.request_factory.default" class="Psr\Http\Message\RequestFactoryInterface">
<factory class="Http\Discovery\Psr17FactoryDiscovery" method="findRequestFactory" />
Expand Down
14 changes: 7 additions & 7 deletions tests/DependencyInjection/NexySlackExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public function testLoadWithMinimalConfiguration(): void
$this->assertContainerBuilderHasParameter('nexy_slack.endpoint', $endpoint);
$this->assertContainerBuilderHasParameter('nexy_slack.config', $slackConfig);

$this->assertContainerBuilderHasService(Client::class);
$this->assertContainerBuilderHasService('nexy_slack.client');

$this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 0, new Reference('nexy_slack.http.client'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 1, new Reference('nexy_slack.http.request_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 2, new Reference('nexy_slack.http.stream_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 3, '%nexy_slack.endpoint%');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 4, '%nexy_slack.config%');
$this->assertContainerBuilderHasServiceDefinitionWithArgument('nexy_slack.client', 0, new Reference('nexy_slack.http.client'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument('nexy_slack.client', 1, new Reference('nexy_slack.http.request_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument('nexy_slack.client', 2, new Reference('nexy_slack.http.stream_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithArgument('nexy_slack.client', 3, '%nexy_slack.endpoint%');
$this->assertContainerBuilderHasServiceDefinitionWithArgument('nexy_slack.client', 4, '%nexy_slack.config%');

$this->assertContainerBuilderHasAlias('nexy_slack.client', Client::class);
$this->assertContainerBuilderHasAlias(Client::class, 'nexy_slack.client');
$this->assertContainerBuilderHasAlias('nexy_slack.http.client', 'httplug.client');
$this->assertContainerBuilderHasAlias('nexy_slack.http.request_factory', 'nexy_slack.request_factory.default');
$this->assertContainerBuilderHasAlias('nexy_slack.http.stream_factory', 'nexy_slack.stream_factory.default');
Expand Down

0 comments on commit bc550d0

Please sign in to comment.