[Tests] Refactor AB Fuzzing
AbFuzzyServer is now first class EchoServer Updated meta files Cleaned up a WAMP unit test slightly composer alpha7
This commit is contained in:
parent
0dba9fc50e
commit
37d1339359
@ -10,9 +10,9 @@ CHANGELOG
|
|||||||
|
|
||||||
* 0.3.0 (2013-xx-xx)
|
* 0.3.0 (2013-xx-xx)
|
||||||
|
|
||||||
* BC: Require hostname and do Origin HTTP header check against it by default, helping prevent CSRF attacks
|
* Added Symfony/2.2 based HTTP Router component to allowing for a single Ratchet server to handle multiple apps -> Ratchet\Http\Router
|
||||||
* Added HTTP Router component to allowing for a single Ratchet server to handle multiple apps
|
* BC: Decoupled HTTP from WebSocket component -> Ratchet\Http\HttpServer
|
||||||
* BC: Decoupled HTTP from WebSocket component
|
* Updated dependency to React/0.3
|
||||||
|
|
||||||
* 0.2.5 (2013-04-01)
|
* 0.2.5 (2013-04-01)
|
||||||
|
|
||||||
|
6
Makefile
6
Makefile
@ -8,10 +8,8 @@ cover:
|
|||||||
phpunit --coverage-text --coverage-html=reports/coverage
|
phpunit --coverage-text --coverage-html=reports/coverage
|
||||||
|
|
||||||
abtests:
|
abtests:
|
||||||
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php 8002 &
|
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php 8001 &
|
||||||
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-stream.php 8001 &
|
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-stream.php 8002 &
|
||||||
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-libev.php 8004 &
|
|
||||||
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-libuv.php 8005 &
|
|
||||||
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-noutf8.php 8003 &
|
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-noutf8.php 8003 &
|
||||||
wstest -m testeeserver -w ws://localhost:8000 &
|
wstest -m testeeserver -w ws://localhost:8000 &
|
||||||
wstest -m fuzzingclient -s tests/AutobahnTestSuite/fuzzingclient-all.json
|
wstest -m fuzzingclient -s tests/AutobahnTestSuite/fuzzingclient-all.json
|
||||||
|
@ -17,10 +17,10 @@ Shell access is required and root access is recommended.
|
|||||||
To avoid proxy/firewall blockage it's recommended WebSockets are run on port 80, which requires root access.
|
To avoid proxy/firewall blockage it's recommended WebSockets are run on port 80, which requires root access.
|
||||||
In order to do this, along with your sync web stack, you can either use a proxy or two separate machines. You can find more details in the [server conf docs](http://socketo.me/docs/deploy#sconf).
|
In order to do this, along with your sync web stack, you can either use a proxy or two separate machines. You can find more details in the [server conf docs](http://socketo.me/docs/deploy#sconf).
|
||||||
|
|
||||||
PHP 5.3.3 (or higher) is required. If you have access, PHP 5.4 is *highly* recommended for its performance improvements.
|
|
||||||
|
|
||||||
Cookies from your domain will be passed to the socket server, allowing you to identify users.
|
Cookies from your domain will be passed to the socket server, allowing you to identify users.
|
||||||
Accessing your website's session data in Ratchet requires you to use [Symfony2 Sessions](http://symfony.com/doc/master/components/http_foundation/sessions.html) on your website.
|
Accessing your website's session data in Ratchet requires you to use [Symfony2 Sessions](http://symfony.com/doc/master/components/http_foundation/sessions.html) on your website.
|
||||||
|
PHP 5.3.9 (or higher) is required. If you have access, PHP 5.4 is *highly* recommended for its performance improvements.
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
|
48
composer.lock
generated
48
composer.lock
generated
@ -46,17 +46,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzle/common",
|
"name": "guzzle/common",
|
||||||
"version": "v3.4.1",
|
"version": "v3.4.3",
|
||||||
"target-dir": "Guzzle/Common",
|
"target-dir": "Guzzle/Common",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/common.git",
|
"url": "https://github.com/guzzle/common.git",
|
||||||
"reference": "v3.4.1"
|
"reference": "v3.4.3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/common/zipball/v3.4.1",
|
"url": "https://api.github.com/repos/guzzle/common/zipball/v3.4.3",
|
||||||
"reference": "v3.4.1",
|
"reference": "v3.4.3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -66,7 +66,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.3-dev"
|
"dev-master": "3.4-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -86,21 +86,21 @@
|
|||||||
"event",
|
"event",
|
||||||
"exception"
|
"exception"
|
||||||
],
|
],
|
||||||
"time": "2013-04-16 20:56:26"
|
"time": "2013-04-30 20:30:19"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzle/http",
|
"name": "guzzle/http",
|
||||||
"version": "v3.4.1",
|
"version": "v3.4.3",
|
||||||
"target-dir": "Guzzle/Http",
|
"target-dir": "Guzzle/Http",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/http.git",
|
"url": "https://github.com/guzzle/http.git",
|
||||||
"reference": "v3.4.1"
|
"reference": "v3.4.3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/http/zipball/v3.4.1",
|
"url": "https://api.github.com/repos/guzzle/http/zipball/v3.4.3",
|
||||||
"reference": "v3.4.1",
|
"reference": "v3.4.3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -115,7 +115,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.3-dev"
|
"dev-master": "3.4-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -143,21 +143,21 @@
|
|||||||
"http",
|
"http",
|
||||||
"http client"
|
"http client"
|
||||||
],
|
],
|
||||||
"time": "2013-04-16 20:27:11"
|
"time": "2013-04-30 20:30:19"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzle/parser",
|
"name": "guzzle/parser",
|
||||||
"version": "v3.4.1",
|
"version": "v3.4.3",
|
||||||
"target-dir": "Guzzle/Parser",
|
"target-dir": "Guzzle/Parser",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/parser.git",
|
"url": "https://github.com/guzzle/parser.git",
|
||||||
"reference": "v3.4.1"
|
"reference": "v3.4.3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/parser/zipball/v3.4.1",
|
"url": "https://api.github.com/repos/guzzle/parser/zipball/v3.4.3",
|
||||||
"reference": "v3.4.1",
|
"reference": "v3.4.3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -166,7 +166,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.3-dev"
|
"dev-master": "3.4-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -187,21 +187,21 @@
|
|||||||
"message",
|
"message",
|
||||||
"url"
|
"url"
|
||||||
],
|
],
|
||||||
"time": "2013-03-07 22:13:59"
|
"time": "2013-04-26 15:47:38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzle/stream",
|
"name": "guzzle/stream",
|
||||||
"version": "v3.4.1",
|
"version": "v3.4.3",
|
||||||
"target-dir": "Guzzle/Stream",
|
"target-dir": "Guzzle/Stream",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/stream.git",
|
"url": "https://github.com/guzzle/stream.git",
|
||||||
"reference": "v3.4.1"
|
"reference": "v3.4.3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/stream/zipball/v3.4.1",
|
"url": "https://api.github.com/repos/guzzle/stream/zipball/v3.4.3",
|
||||||
"reference": "v3.4.1",
|
"reference": "v3.4.3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -214,7 +214,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.3-dev"
|
"dev-master": "3.4-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -240,7 +240,7 @@
|
|||||||
"component",
|
"component",
|
||||||
"stream"
|
"stream"
|
||||||
],
|
],
|
||||||
"time": "2013-04-06 18:28:51"
|
"time": "2013-04-26 15:47:38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "react/event-loop",
|
"name": "react/event-loop",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\Tests;
|
namespace Ratchet\Server;
|
||||||
use Ratchet\MessageComponentInterface;
|
use Ratchet\MessageComponentInterface;
|
||||||
use Ratchet\ConnectionInterface;
|
use Ratchet\ConnectionInterface;
|
||||||
|
|
||||||
class AbFuzzyServer implements MessageComponentInterface {
|
class EchoServer implements MessageComponentInterface {
|
||||||
public function onOpen(ConnectionInterface $conn) {
|
public function onOpen(ConnectionInterface $conn) {
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$loop = new React\EventLoop\LibEvLoop;
|
$loop = new React\EventLoop\LibEvLoop;
|
||||||
$sock = new React\Socket\Server($loop);
|
$sock = new React\Socket\Server($loop);
|
||||||
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer));
|
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Server\EchoServer));
|
||||||
|
|
||||||
$port = $argc > 1 ? $argv[1] : 8000;
|
$port = $argc > 1 ? $argv[1] : 8000;
|
||||||
$sock->listen($port, '0.0.0.0');
|
$sock->listen($port, '0.0.0.0');
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$loop = new React\EventLoop\LibEventLoop;
|
$loop = new React\EventLoop\LibEventLoop;
|
||||||
$sock = new React\Socket\Server($loop);
|
$sock = new React\Socket\Server($loop);
|
||||||
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer));
|
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Server\EchoServer));
|
||||||
|
|
||||||
$port = $argc > 1 ? $argv[1] : 8000;
|
$port = $argc > 1 ? $argv[1] : 8000;
|
||||||
$sock->listen($port, '0.0.0.0');
|
$sock->listen($port, '0.0.0.0');
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$loop = new React\EventLoop\LibEvLoop;
|
$loop = new React\EventLoop\LibEvLoop;
|
||||||
$sock = new React\Socket\Server($loop);
|
$sock = new React\Socket\Server($loop);
|
||||||
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer));
|
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Server\EchoServer));
|
||||||
|
|
||||||
$port = $argc > 1 ? $argv[1] : 8000;
|
$port = $argc > 1 ? $argv[1] : 8000;
|
||||||
$sock->listen($port, '0.0.0.0');
|
$sock->listen($port, '0.0.0.0');
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$loop = new React\EventLoop\StreamSelectLoop;
|
$loop = new React\EventLoop\StreamSelectLoop;
|
||||||
$sock = new React\Socket\Server($loop);
|
$sock = new React\Socket\Server($loop);
|
||||||
$web = new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer);
|
$web = new Ratchet\WebSocket\WsServer(new Ratchet\Server\EchoServer);
|
||||||
$app = new Ratchet\Http\HttpServer($web);
|
$app = new Ratchet\Http\HttpServer($web);
|
||||||
$web->setEncodingChecks(false);
|
$web->setEncodingChecks(false);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$loop = new React\EventLoop\StreamSelectLoop;
|
$loop = new React\EventLoop\StreamSelectLoop;
|
||||||
$sock = new React\Socket\Server($loop);
|
$sock = new React\Socket\Server($loop);
|
||||||
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer));
|
$app = new Ratchet\Http\HttpServer(new Ratchet\WebSocket\WsServer(new Ratchet\Server\EchoyServer));
|
||||||
|
|
||||||
$port = $argc > 1 ? $argv[1] : 8000;
|
$port = $argc > 1 ? $argv[1] : 8000;
|
||||||
$sock->listen($port, '0.0.0.0');
|
$sock->listen($port, '0.0.0.0');
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
, "outdir": "reports/ab"
|
, "outdir": "reports/ab"
|
||||||
|
|
||||||
, "servers": [
|
, "servers": [
|
||||||
{"agent": "Ratchet/0.2.5 libevent", "url": "ws://localhost:8002", "options": {"version": 18}}
|
{"agent": "Ratchet/0.3 libevent", "url": "ws://localhost:8001", "options": {"version": 18}}
|
||||||
, {"agent": "Ratchet/0.2.5 libuv", "url": "ws://localhost:8005", "options": {"version": 18}}
|
, {"agent": "Ratchet/0.3 streams", "url": "ws://localhost:8002", "options": {"version": 18}}
|
||||||
, {"agent": "Ratchet/0.2.5 libev", "url": "ws://localhost:8004", "options": {"version": 18}}
|
, {"agent": "Ratchet/0.3 -utf8", "url": "ws://localhost:8003", "options": {"version": 18}}
|
||||||
, {"agent": "Ratchet/0.2.5 -utf8", "url": "ws://localhost:8003", "options": {"version": 18}}
|
|
||||||
, {"agent": "Ratchet/0.2.5 streams", "url": "ws://localhost:8001", "options": {"version": 18}}
|
|
||||||
, {"agent": "AutobahnTestSuite/0.5.9", "url": "ws://localhost:8000", "options": {"version": 18}}
|
, {"agent": "AutobahnTestSuite/0.5.9", "url": "ws://localhost:8000", "options": {"version": 18}}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
26
tests/Ratchet/Tests/Server/EchoServerTest.php
Normal file
26
tests/Ratchet/Tests/Server/EchoServerTest.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace Ratchet\Tests\Server;
|
||||||
|
use Ratchet\Server\EchoServer;
|
||||||
|
|
||||||
|
class EchoServerTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
protected $_conn;
|
||||||
|
protected $_comp;
|
||||||
|
|
||||||
|
public function setUp() {
|
||||||
|
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
|
||||||
|
$this->_comp = new EchoServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMessageEchod() {
|
||||||
|
$message = 'Tillsonburg, my back still aches when I hear that word.';
|
||||||
|
$this->_conn->expects($this->once())->method('send')->with($message);
|
||||||
|
$this->_comp->onMessage($this->_conn, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testErrorClosesConnection() {
|
||||||
|
ob_start();
|
||||||
|
$this->_conn->expects($this->once())->method('close');
|
||||||
|
$this->_comp->onError($this->_conn, new \Exception);
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
}
|
@ -7,12 +7,20 @@ use Ratchet\Wamp\TopicManager;
|
|||||||
*/
|
*/
|
||||||
class TopicManagerTest extends \PHPUnit_Framework_TestCase {
|
class TopicManagerTest extends \PHPUnit_Framework_TestCase {
|
||||||
private $mock;
|
private $mock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Ratchet\Wamp\TopicManager
|
||||||
|
*/
|
||||||
private $mngr;
|
private $mngr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Ratchet\ConnectionInterface
|
||||||
|
*/
|
||||||
private $conn;
|
private $conn;
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->conn = $this->getMock('Ratchet\\ConnectionInterface');
|
$this->conn = $this->getMock('\Ratchet\ConnectionInterface');
|
||||||
$this->mock = $this->getMock('Ratchet\\Wamp\\WampServerInterface');
|
$this->mock = $this->getMock('\Ratchet\Wamp\\WampServerInterface');
|
||||||
$this->mngr = new TopicManager($this->mock);
|
$this->mngr = new TopicManager($this->mock);
|
||||||
|
|
||||||
$this->conn->WAMP = new \StdClass;
|
$this->conn->WAMP = new \StdClass;
|
||||||
|
Loading…
Reference in New Issue
Block a user