Skip to content

Commit

Permalink
Fix dealer role missing issue add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbonneau committed Jul 15, 2017
1 parent 37b7c64 commit 2927b39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Thruway/Role/Dealer.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getSubscribedRealmEvents()
"YieldMessageEvent" => ["handleYieldMessage", 10],
"ErrorMessageEvent" => ["handleErrorMessage", 10],
"LeaveRealm" => ["handleLeaveRealm", 10],
"SendWelcomeMessageEvent" => ["handleSendWelcomeMessage", 10]
"SendWelcomeMessageEvent" => ["handleSendWelcomeMessage", 20]
];
}

Expand Down
7 changes: 6 additions & 1 deletion tests/Unit/Peer/RouterTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use Thruway\Message\WelcomeMessage;

/**
* Class RouterTest
Expand Down Expand Up @@ -110,8 +111,12 @@ public function testHelloMessage()
->method('sendMessage')
->with(
$this->callback(
function ($msg) {
function (WelcomeMessage $msg) {
$this->assertInstanceOf('\Thruway\Message\WelcomeMessage', $msg);
$this->assertNotEmpty($msg->getDetails());
$this->assertObjectHasAttribute('roles', $msg->getDetails());
$this->assertObjectHasAttribute('dealer', $msg->getDetails()->roles);
$this->assertObjectHasAttribute('broker', $msg->getDetails()->roles);

return $msg instanceof Thruway\Message\WelcomeMessage;
}
Expand Down

0 comments on commit 2927b39

Please sign in to comment.