Merge pull request #50 from vkartaviy/sub-protocol-fix

#49 Fixed WsServer::getSubProtocolString method return value
This commit is contained in:
Chris Boden 2012-10-13 10:52:42 -07:00
commit 7cf149f003
2 changed files with 4 additions and 4 deletions

View File

@ -200,15 +200,15 @@ class WsServer implements MessageComponentInterface {
return '';
}
$string = '';
$result = array();
foreach ($requested as $sub) {
if ($this->isSubProtocolSupported($sub)) {
$string .= $sub . ',';
$result[] = $sub;
}
}
return substr($string, 0, -1);
return implode(',', $result);
}
/**

View File

@ -45,6 +45,6 @@ class WsServerTest extends \PHPUnit_Framework_TestCase {
$method = $class->getMethod('getSubProtocolString');
$method->setAccessible(true);
$this->assertEquals($expected, $method->invokeArgs($this->serv, array($req)));
$this->assertSame($expected, $method->invokeArgs($this->serv, array($req)));
}
}