Skip to content

Commit

Permalink
Rename AddCommandBusPass as MessageBusPass
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Sep 25, 2017
1 parent d540d8f commit edde87b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $handler_provider = new ContainerHandlerProvider([
], $container);
```

If you're using [symfony/dependency-injection][] you can add an instance of [AddCommandBusPass][]
If you're using [symfony/dependency-injection][] you can add an instance of [MessageBusPass][]
to your compilation pass to automatically generate the provider:

```yaml
Expand All @@ -138,18 +138,18 @@ services:
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
use ICanBoogie\MessageBus\Symfony\AddCommandBusPass;
use ICanBoogie\MessageBus\Symfony\MessageBusPass;

/* @var string $config */
/* @var ICanBoogie\MessageBus\PSR\ContainerHandlerProvider $provider */

$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
$loader->load($config);
$container->addCompilerPass(new AddCommandBusPass);
$container->addCompilerPass(new MessageBusPass);
$container->compile();

$provider = $container->get(AddCommandBusPass::DEFAULT_PROVIDER_SERVICE);
$provider = $container->get(MessageBusPass::DEFAULT_PROVIDER_SERVICE);
```


Expand Down Expand Up @@ -252,9 +252,10 @@ The package is continuously tested by [Travis CI](http://about.travis-ci.org/).


[documentation]: https://icanboogie.org/api/message-bus/master/
[AssertingDispatcher]: https://icanboogie.org/api/message-bus/master/class-ICanBoogie.MessageBus.AssertingMessageBus.html
[AssertingDispatcher]: https://icanboogie.org/api/message-bus/master/class-ICanBoogie.MessageBus.AssertingDispatcher.html
[HandlerProvider]: https://icanboogie.org/api/message-bus/master/class-ICanBoogie.MessageBus.HandlerProvider.html
[AddCommandBusPass]: https://icanboogie.org/api/message-bus/master/class-ICanBoogie.MessageBus.Symfony.AddCommandBusPass.html
[MessageBusPass]: https://icanboogie.org/api/message-bus/master/class-ICanBoogie.MessageBus.Symfony.MessageBusPass.html
[available on GitHub]: https://github.com/ICanBoogie/MessageBus
[icanboogie/service]: https://github.com/ICanBoogie/Service
[PSR container]: https://github.com/php-fig/container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Registers command bus handlers.
*/
class AddCommandBusPass implements CompilerPassInterface
class MessageBusPass implements CompilerPassInterface
{
const DEFAULT_PROVIDER_SERVICE = 'message_bus.handler_provider';
const DEFAULT_HANDLER_TAG = 'message_bus.handler';
Expand Down
6 changes: 3 additions & 3 deletions tests/Symfony/AddCommandBusPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class AddCommandBusPassTest extends \PHPUnit_Framework_TestCase
class MessageBusPassTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException \InvalidArgumentException
Expand All @@ -44,7 +44,7 @@ public function test_should_return_handler()
{
/* @var ContainerHandlerProvider $provider */
$container = $this->makeContainer(__DIR__ . '/resources/ok.yml');
$provider = $container->get(AddCommandBusPass::DEFAULT_PROVIDER_SERVICE);
$provider = $container->get(MessageBusPass::DEFAULT_PROVIDER_SERVICE);

$this->assertInstanceOf(ContainerHandlerProvider::class, $provider);
$this->assertInstanceOf(HandlerA::class, $provider(new MessageA()));
Expand All @@ -61,7 +61,7 @@ private function makeContainer($config)
$container = new SymfonyContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
$loader->load($config);
$container->addCompilerPass(new AddCommandBusPass);
$container->addCompilerPass(new MessageBusPass);
$container->compile();

return $container;
Expand Down

0 comments on commit edde87b

Please sign in to comment.