Skip to content

Commit

Permalink
Add Nexy\Slack\Client service autowiring (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaquestNet authored and soullivaneuh committed Aug 12, 2019
1 parent 4e55be5 commit 18814a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
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"/>
</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

0 comments on commit 18814a9

Please sign in to comment.