Merge pull request #50 from vkartaviy/sub-protocol-fix
#49 Fixed WsServer::getSubProtocolString method return value
This commit is contained in:
commit
7cf149f003
@ -200,15 +200,15 @@ class WsServer implements MessageComponentInterface {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = '';
|
$result = array();
|
||||||
|
|
||||||
foreach ($requested as $sub) {
|
foreach ($requested as $sub) {
|
||||||
if ($this->isSubProtocolSupported($sub)) {
|
if ($this->isSubProtocolSupported($sub)) {
|
||||||
$string .= $sub . ',';
|
$result[] = $sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return substr($string, 0, -1);
|
return implode(',', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,6 @@ class WsServerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$method = $class->getMethod('getSubProtocolString');
|
$method = $class->getMethod('getSubProtocolString');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$this->assertEquals($expected, $method->invokeArgs($this->serv, array($req)));
|
$this->assertSame($expected, $method->invokeArgs($this->serv, array($req)));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user