Merge branch 'refs/heads/master' into 0.4

This commit is contained in:
Chris Boden 2014-04-20 13:11:16 -04:00
commit f7bd1fca89
76 changed files with 135 additions and 89 deletions

View File

@ -1,10 +1,9 @@
{ {
"name": "cboden/Ratchet" "name": "cboden/ratchet"
, "type": "library" , "type": "library"
, "description": "PHP WebSocket library" , "description": "PHP WebSocket library"
, "keywords": ["WebSockets", "Server", "Ratchet", "Sockets"] , "keywords": ["WebSockets", "Server", "Ratchet", "Sockets"]
, "homepage": "http://socketo.me" , "homepage": "http://socketo.me"
, "repository": "https://github.com/cboden/Ratchet"
, "license": "MIT" , "license": "MIT"
, "authors": [ , "authors": [
{ {
@ -25,8 +24,8 @@
} }
, "require": { , "require": {
"php": ">=5.3.9" "php": ">=5.3.9"
, "react/socket": ">=0.3.0,<0.5-dev" , "react/socket": "0.3.*|0.4.*"
, "guzzle/http": ">=3.6.0,<3.9.0-dev" , "guzzle/http": "~3.6"
, "symfony/http-foundation": "~2.2" , "symfony/http-foundation": "~2.2"
, "symfony/routing": "~2.2" , "symfony/routing": "~2.2"
} }

View File

@ -2,7 +2,7 @@
namespace Ratchet; namespace Ratchet;
/** /**
* Wraps ConnectionInterface objects via the decorator pattern but allows * Wraps ConnectionInterface objects via the decorator pattern but allows
* parameters to bubble through with magic methods * parameters to bubble through with magic methods
* @todo It sure would be nice if I could make most of this a trait... * @todo It sure would be nice if I could make most of this a trait...
*/ */
@ -26,16 +26,16 @@ abstract class AbstractConnectionDecorator implements ConnectionInterface {
public function __set($name, $value) { public function __set($name, $value) {
$this->wrappedConn->$name = $value; $this->wrappedConn->$name = $value;
} }
public function __get($name) { public function __get($name) {
return $this->wrappedConn->$name; return $this->wrappedConn->$name;
} }
public function __isset($name) { public function __isset($name) {
return isset($this->wrappedConn->$name); return isset($this->wrappedConn->$name);
} }
public function __unset($name) { public function __unset($name) {
unset($this->wrappedConn->$name); unset($this->wrappedConn->$name);
} }
} }

View File

@ -128,4 +128,4 @@ class App {
public function run() { public function run() {
$this->_server->run(); $this->_server->run();
} }
} }

View File

@ -28,4 +28,4 @@ interface ComponentInterface {
* @throws \Exception * @throws \Exception
*/ */
function onError(ConnectionInterface $conn, \Exception $e); function onError(ConnectionInterface $conn, \Exception $e);
} }

View File

@ -23,4 +23,4 @@ interface ConnectionInterface {
* Close the connection * Close the connection
*/ */
function close(); function close();
} }

View File

@ -6,7 +6,7 @@ use Guzzle\Http\EntityBody;
class RequestFactory extends GuzzleRequestFactory { class RequestFactory extends GuzzleRequestFactory {
protected static $ratchetInstance; protected static $ratchetInstance;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -20,7 +20,7 @@ class RequestFactory extends GuzzleRequestFactory {
return static::$ratchetInstance; return static::$ratchetInstance;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -31,4 +31,4 @@ class RequestFactory extends GuzzleRequestFactory {
return $request; return $request;
} }
} }

View File

@ -53,4 +53,4 @@ class HttpRequestParser implements MessageInterface {
public function isEom($message) { public function isEom($message) {
return (boolean)strpos($message, static::EOM); return (boolean)strpos($message, static::EOM);
} }
} }

View File

@ -76,4 +76,4 @@ class OriginCheck implements HttpServerInterface {
$conn->send((string)$response); $conn->send((string)$response);
$conn->close(); $conn->close();
} }
} }

View File

@ -3,6 +3,7 @@ namespace Ratchet\Http;
use Ratchet\ConnectionInterface; use Ratchet\ConnectionInterface;
use Guzzle\Http\Message\RequestInterface; use Guzzle\Http\Message\RequestInterface;
use Guzzle\Http\Message\Response; use Guzzle\Http\Message\Response;
use Guzzle\Http\Url;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@ -46,6 +47,16 @@ class Router implements HttpServerInterface {
throw new \UnexpectedValueException('All routes must implement Ratchet\Http\HttpServerInterface'); throw new \UnexpectedValueException('All routes must implement Ratchet\Http\HttpServerInterface');
} }
$parameters = array();
foreach($route as $key => $value) {
if ((is_string($key)) && ('_' !== substr($key, 0, 1))) {
$parameters[$key] = $value;
}
}
$url = Url::factory($request->getPath());
$url->setQuery($parameters);
$request->setUrl($url);
$conn->controller = $route['_controller']; $conn->controller = $route['_controller'];
$conn->controller->onOpen($conn, $request); $conn->controller->onOpen($conn, $request);
} }
@ -89,4 +100,4 @@ class Router implements HttpServerInterface {
$conn->send((string)$response); $conn->send((string)$response);
$conn->close(); $conn->close();
} }
} }

View File

@ -2,4 +2,4 @@
namespace Ratchet; namespace Ratchet;
interface MessageComponentInterface extends ComponentInterface, MessageInterface { interface MessageComponentInterface extends ComponentInterface, MessageInterface {
} }

View File

@ -9,4 +9,4 @@ interface MessageInterface {
* @throws \Exception * @throws \Exception
*/ */
function onMessage(ConnectionInterface $from, $msg); function onMessage(ConnectionInterface $from, $msg);
} }

View File

@ -20,4 +20,4 @@ class EchoServer implements MessageComponentInterface {
public function onError(ConnectionInterface $conn, \Exception $e) { public function onError(ConnectionInterface $conn, \Exception $e) {
$conn->close(); $conn->close();
} }
} }

View File

@ -185,4 +185,4 @@ class FlashPolicy implements MessageComponentInterface {
public function validatePorts($port) { public function validatePorts($port) {
return (bool)preg_match('/^(\*|(\d+[,-]?)*\d+)$/', $port); return (bool)preg_match('/^(\*|(\d+[,-]?)*\d+)$/', $port);
} }
} }

View File

@ -35,4 +35,4 @@ class IoConnection implements ConnectionInterface {
public function close() { public function close() {
$this->conn->end(); $this->conn->end();
} }
} }

View File

@ -108,4 +108,4 @@ class IpBlackList implements MessageComponentInterface {
$this->_decorating->onError($conn, $e); $this->_decorating->onError($conn, $e);
} }
} }
} }

View File

@ -13,4 +13,4 @@ interface HandlerInterface {
* @return array * @return array
*/ */
function unserialize($raw); function unserialize($raw);
} }

View File

@ -30,4 +30,4 @@ class PhpBinaryHandler implements HandlerInterface {
return $returnData; return $returnData;
} }
} }

View File

@ -35,4 +35,4 @@ class PhpHandler implements HandlerInterface {
return $returnData; return $returnData;
} }
} }

View File

@ -59,6 +59,7 @@ class SessionProvider implements MessageComponentInterface, WsServerInterface {
// Temporarily fixing HHVM issue w/ reading ini values // Temporarily fixing HHVM issue w/ reading ini values
$handler_name = ini_get('session.serialize_handler'); $handler_name = ini_get('session.serialize_handler');
if ('' === $handler_name) { if ('' === $handler_name) {
trigger_error('ini value session.seralize_handler was empty, assuming "php" - tmp hack/fix, bad things might happen', E_USER_WARNING);
$handler_name = 'php'; $handler_name = 'php';
} }
@ -164,4 +165,4 @@ class SessionProvider implements MessageComponentInterface, WsServerInterface {
protected function toClassCase($langDef) { protected function toClassCase($langDef) {
return str_replace(' ', '', ucwords(str_replace('_', ' ', $langDef))); return str_replace(' ', '', ucwords(str_replace('_', ' ', $langDef)));
} }
} }

View File

@ -51,4 +51,4 @@ class VirtualProxy extends SessionHandlerProxy {
public function setName($name) { public function setName($name) {
throw new \RuntimeException("Can not change session name in VirtualProxy"); throw new \RuntimeException("Can not change session name in VirtualProxy");
} }
} }

View File

@ -56,7 +56,7 @@ class VirtualSessionStorage extends NativeSessionStorage {
// get the data from the bags? // get the data from the bags?
// serialize the data // serialize the data
// save the data using the saveHandler // save the data using the saveHandler
// $this->saveHandler->write($this->saveHandler->getId(), // $this->saveHandler->write($this->saveHandler->getId(),
if (!$this->saveHandler->isWrapper() && !$this->getSaveHandler()->isSessionHandlerInterface()) { if (!$this->saveHandler->isWrapper() && !$this->getSaveHandler()->isSessionHandlerInterface()) {
$this->saveHandler->setActive(false); $this->saveHandler->setActive(false);
@ -79,4 +79,4 @@ class VirtualSessionStorage extends NativeSessionStorage {
$this->saveHandler = $saveHandler; $this->saveHandler = $saveHandler;
} }
} }

View File

@ -2,4 +2,4 @@
namespace Ratchet\Wamp; namespace Ratchet\Wamp;
class Exception extends \Exception { class Exception extends \Exception {
} }

View File

@ -28,4 +28,4 @@ class JsonException extends Exception {
parent::__construct($msg, $code); parent::__construct($msg, $code);
} }
} }

View File

@ -154,4 +154,4 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface {
public function onError(ConnectionInterface $conn, \Exception $e) { public function onError(ConnectionInterface $conn, \Exception $e) {
return $this->_decorating->onError($this->connections[$conn], $e); return $this->_decorating->onError($this->connections[$conn], $e);
} }
} }

View File

@ -77,8 +77,11 @@ class TopicManager implements WsServerInterface, WampServerInterface {
public function onClose(ConnectionInterface $conn) { public function onClose(ConnectionInterface $conn) {
$this->app->onClose($conn); $this->app->onClose($conn);
foreach ($this->topicLookup as $topic) { foreach ($this->topicLookup as $topic => $storage) {
$topic->remove($conn); $storage->remove($conn);
if (0 === $storage->count()) {
unset($this->topicLookup[$topic]);
}
} }
} }
@ -111,4 +114,4 @@ class TopicManager implements WsServerInterface, WampServerInterface {
return $this->topicLookup[$topic]; return $this->topicLookup[$topic];
} }
} }

View File

@ -66,4 +66,4 @@ class WampServer implements MessageComponentInterface, WsServerInterface {
public function getSubProtocols() { public function getSubProtocols() {
return $this->wampProtocol->getSubProtocols(); return $this->wampProtocol->getSubProtocols();
} }
} }

View File

@ -40,4 +40,4 @@ interface WampServerInterface extends ComponentInterface {
* @param array $eligible A list of session Ids the message should be send to (whitelist) * @param array $eligible A list of session Ids the message should be send to (whitelist)
*/ */
function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible); function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible);
} }

View File

@ -28,4 +28,4 @@ class ToggleableValidator implements ValidatorInterface {
return $this->validator->checkEncoding($str, $encoding); return $this->validator->checkEncoding($str, $encoding);
} }
} }

View File

@ -90,4 +90,4 @@ class Validator {
return true; return true;
} }
} }

View File

@ -9,4 +9,4 @@ interface ValidatorInterface {
* @return bool * @return bool
*/ */
function checkEncoding($str, $encoding); function checkEncoding($str, $encoding);
} }

View File

@ -25,4 +25,4 @@ interface DataInterface {
* @return string * @return string
*/ */
function getContents(); function getContents();
} }

View File

@ -35,4 +35,4 @@ interface FrameInterface extends DataInterface {
* @return string * @return string
*/ */
function getMaskingKey(); function getMaskingKey();
} }

View File

@ -117,4 +117,4 @@ class Hixie76 implements VersionInterface {
. $code . $code
, true); , true);
} }
} }

View File

@ -16,4 +16,4 @@ class Connection extends AbstractConnectionDecorator {
public function close() { public function close() {
$this->getConnection()->close(); $this->getConnection()->close();
} }
} }

View File

@ -83,4 +83,4 @@ class Frame implements FrameInterface {
public function extractOverflow() { public function extractOverflow() {
return ''; return '';
} }
} }

View File

@ -12,4 +12,4 @@ class HyBi10 extends RFC6455 {
public function getVersionNumber() { public function getVersionNumber() {
return 6; return 6;
} }
} }

View File

@ -12,4 +12,4 @@ interface MessageInterface extends DataInterface {
* @return int * @return int
*/ */
function getOpcode(); function getOpcode();
} }

View File

@ -30,4 +30,4 @@ class Connection extends AbstractConnectionDecorator {
$this->getConnection()->close(); $this->getConnection()->close();
} }
} }

View File

@ -347,7 +347,7 @@ class Frame implements FrameInterface {
$bits += 16; $bits += 16;
} }
// If the value of the initial payload length are is 127 an additional 48 bits are used to describe length // If the value of the initial payload length are is 127 an additional 48 bits are used to describe length
// Note: The documentation specifies the length is to be 63 bits, but I think that's a typo and is 64 (16+48) // Note: The documentation specifies the length is to be 63 bits, but I think that's a typo and is 64 (16+48)
if ($check === 127) { if ($check === 127) {
$bits += 48; $bits += 48;
@ -447,4 +447,4 @@ class Frame implements FrameInterface {
return ''; return '';
} }
} }

View File

@ -134,4 +134,4 @@ class HandshakeVerifier {
*/ */
public function verifyExtensions($val) { public function verifyExtensions($val) {
} }
} }

View File

@ -104,4 +104,4 @@ class Message implements MessageInterface, \Countable {
return $buffer; return $buffer;
} }
} }

View File

@ -54,4 +54,4 @@ interface VersionInterface extends MessageInterface {
* @todo Change to use other classes, this will be removed eventually * @todo Change to use other classes, this will be removed eventually
*/ */
//function frame($message, $mask = true); //function frame($message, $mask = true);
} }

View File

@ -87,4 +87,4 @@ class VersionManager {
public function getSupportedVersionString() { public function getSupportedVersionString() {
return $this->versionString; return $this->versionString;
} }
} }

View File

@ -224,4 +224,4 @@ class WsServer implements HttpServerInterface {
$conn->send((string)$response); $conn->send((string)$response);
$conn->close(); $conn->close();
} }
} }

View File

@ -11,4 +11,4 @@ interface WsServerInterface {
* @temporary This method may be removed in future version (note that will not break code, just make some code obsolete) * @temporary This method may be removed in future version (note that will not break code, just make some code obsolete)
*/ */
function getSubProtocols(); function getSubProtocols();
} }

View File

@ -47,4 +47,4 @@ abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestC
$this->_app->expects($this->once())->method('onMessage')->with($this->isExpectedConnection(), $value); $this->_app->expects($this->once())->method('onMessage')->with($this->isExpectedConnection(), $value);
$this->_serv->onMessage($this->_conn, $value); $this->_serv->onMessage($this->_conn, $value);
} }
} }

View File

@ -32,4 +32,4 @@ class Component implements MessageComponentInterface, WsServerInterface {
public function getSubProtocols() { public function getSubProtocols() {
return $this->protocols; return $this->protocols;
} }
} }

View File

@ -17,4 +17,4 @@ class Connection implements ConnectionInterface {
public function close() { public function close() {
$this->last[__FUNCTION__] = true; $this->last[__FUNCTION__] = true;
} }
} }

View File

@ -19,4 +19,4 @@ class ConnectionDecorator extends AbstractConnectionDecorator {
$this->getConnection()->close(); $this->getConnection()->close();
} }
} }

View File

@ -40,4 +40,4 @@ class WampComponent implements WampServerInterface, WsServerInterface {
public function onError(ConnectionInterface $conn, \Exception $e) { public function onError(ConnectionInterface $conn, \Exception $e) {
$this->last[__FUNCTION__] = func_get_args(); $this->last[__FUNCTION__] = func_get_args();
} }
} }

View File

@ -25,4 +25,4 @@ class NullComponent implements MessageComponentInterface, WsServerInterface, Wam
public function getSubProtocols() { public function getSubProtocols() {
return array(); return array();
} }
} }

View File

@ -4,4 +4,4 @@ use Ratchet\WebSocket\WsServerInterface;
use Ratchet\Wamp\WampServerInterface; use Ratchet\Wamp\WampServerInterface;
interface WsWampServerInterface extends WsServerInterface, WampServerInterface { interface WsWampServerInterface extends WsServerInterface, WampServerInterface {
} }

View File

@ -4,4 +4,4 @@ use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface { interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface {
} }

View File

@ -50,4 +50,4 @@ class GuzzleTest extends \PHPUnit_Framework_TestCase {
$ref = new \ReflectionMethod('Guzzle\Http\Message\RequestFactory', 'create'); $ref = new \ReflectionMethod('Guzzle\Http\Message\RequestFactory', 'create');
$this->assertEquals(2, $ref->getNumberOfRequiredParameters()); $this->assertEquals(2, $ref->getNumberOfRequiredParameters());
} }
} }

View File

@ -144,4 +144,4 @@ class AbstractConnectionDecoratorTest extends \PHPUnit_Framework_TestCase {
$this->setExpectedException('PHPUnit_Framework_Error'); $this->setExpectedException('PHPUnit_Framework_Error');
$var = $this->l2->nonExistant; $var = $this->l2->nonExistant;
} }
} }

View File

@ -64,4 +64,4 @@ class RequestFactoryTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($parts['body'], (string)$object->getBody()); $this->assertEquals($parts['body'], (string)$object->getBody());
} }
} }

View File

@ -48,4 +48,4 @@ class HttpRequestParserTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('\Guzzle\Http\Message\RequestInterface', $return); $this->assertInstanceOf('\Guzzle\Http\Message\RequestInterface', $return);
} }
} }

View File

@ -61,4 +61,4 @@ class HttpServerTest extends AbstractMessageComponentTestCase {
$this->_serv->onMessage($this->_conn, "GET / HTTP/1.1"); $this->_serv->onMessage($this->_conn, "GET / HTTP/1.1");
} }
} }

View File

@ -1,7 +1,9 @@
<?php <?php
namespace Ratchet\Http; namespace Ratchet\Http;
use Ratchet\Http\Router; use Ratchet\Http\Router;
use Ratchet\WebSocket\WsServerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
/** /**
* @covers Ratchet\Http\Router * @covers Ratchet\Http\Router
@ -85,4 +87,27 @@ class RouterTest extends \PHPUnit_Framework_TestCase {
$this->_router->onError($this->_conn, $e); $this->_router->onError($this->_conn, $e);
} }
public function testRouterGeneratesRouteParameters()
{
/** @var $controller WsServerInterface */
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
/** @var $matcher UrlMatcherInterface */
$this->_matcher->expects($this->any())->method('match')->will(
$this->returnValue(array('_controller' => $controller, 'foo' => 'bar', 'baz' => 'qux'))
);
$conn = $this->getMock('Ratchet\Mock\Connection');
$request = $this->getMock('Guzzle\Http\Message\Request', array('getPath'), array('GET', 'ws://random.url'), '', false);
$request->expects($this->any())->method('getPath')->will($this->returnValue('ws://doesnt.matter/'));
$request->setHeaderFactory($this->getMock('Guzzle\Http\Message\Header\HeaderFactoryInterface'));
$request->setUrl('ws://doesnt.matter/');
$router = new Router($this->_matcher);
$router->onOpen($conn, $request);
$this->assertEquals(array('foo' => 'bar', 'baz' => 'qux'), $request->getQuery()->getAll());
}
} }

View File

@ -149,4 +149,4 @@ class FlashPolicyTest extends \PHPUnit_Framework_TestCase {
$conn = $this->getMock('\Ratchet\ConnectionInterface'); $conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_policy->onClose($conn); $this->_policy->onClose($conn);
} }
} }

View File

@ -29,4 +29,4 @@ class IoConnectionTest extends \PHPUnit_Framework_TestCase {
public function testSendReturnsSelf() { public function testSendReturnsSelf() {
$this->assertSame($this->conn, $this->conn->send('fluent interface')); $this->assertSame($this->conn, $this->conn->send('fluent interface'));
} }
} }

View File

@ -115,4 +115,4 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
$this->server->handleData('f', $conn); $this->server->handleData('f', $conn);
} }
} }

View File

@ -122,4 +122,4 @@ class IpBlackListTest extends \PHPUnit_Framework_TestCase {
return $conn; return $conn;
} }
} }

View File

@ -33,4 +33,4 @@ class PhpHandlerTest extends \PHPUnit_Framework_TestCase {
public function testUnserialize($in, $expected) { public function testUnserialize($in, $expected) {
$this->assertEquals($expected, $this->_handler->unserialize($in)); $this->assertEquals($expected, $this->_handler->unserialize($in));
} }
} }

View File

@ -264,4 +264,4 @@ class ServerProtocolTest extends \PHPUnit_Framework_TestCase {
$this->_comp->onOpen($conn); $this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, $message); $this->_comp->onMessage($conn, $message);
} }
} }

View File

@ -166,12 +166,19 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$method = $class->getMethod('getTopic'); $method = $class->getMethod('getTopic');
$method->setAccessible(true); $method->setAccessible(true);
$attribute = $class->getProperty('topicLookup');
$attribute->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name)); $topic = $method->invokeArgs($this->mngr, array($name));
$this->assertCount(1, $attribute->getValue($this->mngr));
$this->mngr->onSubscribe($this->conn, $name); $this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onClose($this->conn); $this->mngr->onClose($this->conn);
$this->assertFalse($topic->has($this->conn)); $this->assertFalse($topic->has($this->conn));
$this->assertCount(0, $attribute->getValue($this->mngr));
} }
public function testOnErrorBubbles() { public function testOnErrorBubbles() {
@ -193,4 +200,4 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($subs, $mngr->getSubProtocols()); $this->assertEquals($subs, $mngr->getSubProtocols());
} }
} }

View File

@ -74,4 +74,4 @@ class WampConnectionTest extends \PHPUnit_Framework_TestCase {
$conn->close(); $conn->close();
} }
} }

View File

@ -46,4 +46,4 @@ class WampServerTest extends AbstractMessageComponentTestCase {
$this->_conn->expects($this->once())->method('close'); $this->_conn->expects($this->once())->method('close');
$this->_serv->onMessage($this->_conn, json_encode(array('valid' => 'json', 'invalid' => 'protocol'))); $this->_serv->onMessage($this->_conn, json_encode(array('valid' => 'json', 'invalid' => 'protocol')));
} }
} }

View File

@ -80,4 +80,4 @@ class Hixie76Test extends \PHPUnit_Framework_TestCase {
$mockApp->expects($this->once())->method('onOpen'); $mockApp->expects($this->once())->method('onOpen');
$server->onMessage($mockConn, $body . $this->_crlf . $this->_crlf); $server->onMessage($mockConn, $body . $this->_crlf . $this->_crlf);
} }
} }

View File

@ -64,4 +64,4 @@ class HyBi10Test extends \PHPUnit_Framework_TestCase {
$this->assertEquals($string, $frame->getPayload()); $this->assertEquals($string, $frame->getPayload());
} }
} }

View File

@ -29,7 +29,7 @@ class FrameTest extends \PHPUnit_Framework_TestCase {
while (strlen($in) >= 8) { while (strlen($in) >= 8) {
$out .= static::encode(substr($in, 0, 8)); $out .= static::encode(substr($in, 0, 8));
$in = substr($in, 8); $in = substr($in, 8);
} }
return $out; return $out;
@ -500,4 +500,4 @@ class FrameTest extends \PHPUnit_Framework_TestCase {
return $randomString; return $randomString;
} }
} }

View File

@ -167,4 +167,4 @@ class HandshakeVerifierTest extends \PHPUnit_Framework_TestCase {
public function testVersionEquals13($expected, $in) { public function testVersionEquals13($expected, $in) {
$this->assertEquals($expected, $this->_v->verifyVersion($in)); $this->assertEquals($expected, $this->_v->verifyVersion($in));
} }
} }

View File

@ -60,4 +60,4 @@ class MessageTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(28, $this->message->getPayloadLength()); $this->assertEquals(28, $this->message->getPayloadLength());
} }
} }

View File

@ -148,4 +148,4 @@ class RFC6455Test extends \PHPUnit_Framework_TestCase {
public function testNewFrame() { public function testNewFrame() {
$this->assertInstanceOf('\\Ratchet\\WebSocket\\Version\\RFC6455\\Frame', $this->version->newFrame()); $this->assertInstanceOf('\\Ratchet\\WebSocket\\Version\\RFC6455\\Frame', $this->version->newFrame());
} }
} }

View File

@ -88,4 +88,4 @@ class VersionManagerTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(2, count($values)); $this->assertEquals(2, count($values));
$this->assertFalse(array_search(0, $values)); $this->assertFalse(array_search(0, $values));
} }
} }

View File

@ -48,4 +48,4 @@ class WsServerTest extends \PHPUnit_Framework_TestCase {
$this->assertSame($expected, $method->invokeArgs($this->serv, array($req))); $this->assertSame($expected, $method->invokeArgs($this->serv, array($req)));
} }
} }