Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renaming nexy_slack.client service to Nexy\Slack\Client #31

Merged
merged 18 commits into from Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add client service autowiring

## [2.1.0]
### Added
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/config/client.xml
Expand Up @@ -5,10 +5,12 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

</services>
</container>
9 changes: 5 additions & 4 deletions tests/DependencyInjection/NexySlackExtensionTest.php
Expand Up @@ -47,12 +47,13 @@ public function testLoadWithMinimalConfiguration(): void
$this->assertContainerBuilderHasParameter('nexy_slack.endpoint', $endpoint);
$this->assertContainerBuilderHasParameter('nexy_slack.config', $slackConfig);

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

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

$this->assertContainerBuilderHasAlias('nexy_slack.client', Client::class);
$this->assertContainerBuilderHasAlias('nexy_slack.http.client', 'httplug.client');
}

Expand Down