AutobahnTestSuite
Added files to test Ratchet against the AutobahnTestSuite Bumped version v0.2b Updated how to handle control frames to run the test suite
This commit is contained in:
parent
232f28a1bd
commit
ff07104316
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Ratchet;
|
||||
|
||||
const VERSION = 'Ratchet/0.1.2';
|
||||
const VERSION = 'Ratchet/0.2b';
|
||||
|
||||
/**
|
||||
* A proxy object representing a connection to the application
|
||||
|
@ -15,8 +15,9 @@ class MessageParser {
|
||||
$from->WebSocket->frame->addBuffer($data);
|
||||
if ($from->WebSocket->frame->isCoalesced()) {
|
||||
if ($from->WebSocket->frame->getOpcode() > 2) {
|
||||
$from->close();
|
||||
throw new \UnexpectedValueException('Control frame support coming soon!');
|
||||
unset($from->WebSocket->frame);
|
||||
|
||||
return;
|
||||
}
|
||||
// Check frame
|
||||
// If is control frame, do your thing
|
||||
|
22
tests/Ratchet/Tests/AbFuzzyServer.php
Normal file
22
tests/Ratchet/Tests/AbFuzzyServer.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Ratchet\Tests;
|
||||
use Ratchet\MessageComponentInterface;
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
class AbFuzzyServer implements MessageComponentInterface {
|
||||
public function onOpen(ConnectionInterface $conn) {
|
||||
}
|
||||
|
||||
public function onMessage(ConnectionInterface $from, $msg) {
|
||||
$from->send($msg);
|
||||
}
|
||||
|
||||
public function onClose(ConnectionInterface $conn) {
|
||||
}
|
||||
|
||||
public function onError(ConnectionInterface $conn, \Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
}
|
@ -22,10 +22,10 @@ class HandshakeNegotiatorTest extends \PHPUnit_Framework_TestCase {
|
||||
return array(
|
||||
array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n")
|
||||
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n1")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n1")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖")
|
||||
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖\r\n\r\n")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie\r\n")
|
||||
, array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie\r\n")
|
||||
);
|
||||
}
|
||||
|
||||
|
11
tests/ab-wstest-fuzzyconf.json
Normal file
11
tests/ab-wstest-fuzzyconf.json
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
{
|
||||
"options": {"failByDrop": false},
|
||||
"outdir": "../reports/ab",
|
||||
|
||||
"servers": [{"agent": "Ratchet/v0.2b", "url": "ws://localhost:8000", "options": {"version": 18}}],
|
||||
|
||||
"cases": ["*"],
|
||||
"exclude-cases": ["9.*"],
|
||||
"exclude-agent-cases": {}
|
||||
}
|
10
tests/ab-wstest-server.php
Normal file
10
tests/ab-wstest-server.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
use Ratchet\Server\IoServer;
|
||||
use Ratchet\WebSocket\WsServer;
|
||||
use Ratchet\Tests\AbFuzzyServer;
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$server = IoServer::factory(new WsServer(new AbFuzzyServer), 8000);
|
||||
|
||||
$server->run();
|
Loading…
Reference in New Issue
Block a user