Skip to content

Commit

Permalink
Updated for Prooph/Common v4
Browse files Browse the repository at this point in the history
  • Loading branch information
mkherlakian committed Jun 29, 2018
1 parent 9b807f3 commit 91cde70
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -29,15 +29,15 @@
},
"require": {
"php": "~5.5|~7.0",
"prooph/common": "^3.5",
"prooph/common": "^4.1",
"bernard/bernard": "1.0.*@dev"
},
"require-dev": {
"prooph/service-bus": "dev-master",
"phpunit/phpunit": "~4.7",
"doctrine/dbal" : "~2.4",
"fabpot/php-cs-fixer": "1.7.*",
"satooshi/php-coveralls": "dev-master"
"php-coveralls/php-coveralls": "~1.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/BernardMessageProducer.php
Expand Up @@ -50,7 +50,7 @@ public function __construct(Producer $bernardProducer, $queue = null)
/**
* @inheritdoc
*/
public function __invoke(Message $message, Deferred $deferred = null)
public function __invoke(Message $message, Deferred $deferred = null) : void
{
if (null !== $deferred) {
throw new RuntimeException(__CLASS__ . ' cannot handle query messages which require future responses.');
Expand Down
16 changes: 11 additions & 5 deletions tests/BernardMessageProducerTest.php
Expand Up @@ -34,7 +34,7 @@
use Prophecy\Argument;
use React\Promise\Deferred;
use Symfony\Component\EventDispatcher\EventDispatcher;

use PHPUnit\Framework\TestCase;

/**
* Class BernardMessageProducerTest
Expand Down Expand Up @@ -132,9 +132,13 @@ public function it_sends_a_command_to_queue_pulls_it_with_consumer_and_forwards_

$doSomethingHandler = new MessageHandler();

$consumerCommandBus->utilize(new CommandRouter([
$router = new CommandRouter([
$command->messageName() => $doSomethingHandler
]));
]);

$router->attachToMessageBus($consumerCommandBus);

$consumerCommandBus->dispatch($command);

//We use a special bernard router which forwards all messages to a command bus or event bus depending on the
//Prooph\ServiceBus\Message\MessageHeader::TYPE
Expand Down Expand Up @@ -169,9 +173,11 @@ public function it_sends_an_event_to_queue_pulls_it_with_consumer_and_forwards_i

$somethingDoneListener = new MessageHandler();

$consumerEventBus->utilize(new EventRouter([
$router = new EventRouter([
$event->messageName() => [$somethingDoneListener]
]));
]);

$router->attachToMessageBus($consumerEventBus);

//We use a special bernard router which forwards all messages to a command bus or event bus depending on the
//Prooph\ServiceBus\Message\MessageHeader::TYPE
Expand Down
1 change: 1 addition & 0 deletions tests/BernardMessageTest.php
Expand Up @@ -12,6 +12,7 @@

use Prooph\Common\Messaging\Message;
use Prooph\ServiceBus\Message\Bernard\BernardMessage;
use PHPUnit\Framework\TestCase;

/**
* Class BernardMessageTest
Expand Down
1 change: 1 addition & 0 deletions tests/BernardRouterTest.php
Expand Up @@ -16,6 +16,7 @@
use Prooph\ServiceBus\EventBus;
use Prooph\ServiceBus\Message\Bernard\BernardMessage;
use Prooph\ServiceBus\Message\Bernard\BernardRouter;
use PHPUnit\Framework\TestCase;

/**
* Class BernardRouterTest
Expand Down
1 change: 1 addition & 0 deletions tests/BernardSerializerTest.php
Expand Up @@ -16,6 +16,7 @@
use Prooph\ServiceBus\Message\Bernard\BernardMessage;
use Prooph\ServiceBus\Message\Bernard\BernardSerializer;
use ProophTest\ServiceBus\Mock\DoSomething;
use PHPUnit\Framework\TestCase;

/**
* Class BernardSerializerTest
Expand Down

0 comments on commit 91cde70

Please sign in to comment.