[Tests] Restructured test filesystem layout

This commit is contained in:
Chris Boden 2013-06-16 10:12:48 -04:00
parent e7541fdfcf
commit a876770cda
46 changed files with 81 additions and 78 deletions

View File

@ -8,21 +8,21 @@ cover:
phpunit --coverage-text --coverage-html=reports/coverage
abtests:
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php 8001 &
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-stream.php 8002 &
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-noutf8.php 8003 &
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver-libevent.php 8001 &
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver-stream.php 8002 &
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver-noutf8.php 8003 &
wstest -m testeeserver -w ws://localhost:8000 &
wstest -m fuzzingclient -s tests/AutobahnTestSuite/fuzzingclient-all.json
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-all.json
killall php wstest
abtest:
ulimit -n 2048 && php tests/AutobahnTestSuite/bin/fuzzingserver-stream.php &
wstest -m fuzzingclient -s tests/AutobahnTestSuite/fuzzingclient-quick.json
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver-stream.php &
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-quick.json
killall php
profile:
php -d 'xdebug.profiler_enable=1' tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php &
wstest -m fuzzingclient -s tests/AutobahnTestSuite/fuzzingclient-profile.json
php -d 'xdebug.profiler_enable=1' tests/autobahn/bin/fuzzingserver-libevent.php &
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-profile.json
killall php
apidocs:

View File

@ -20,8 +20,7 @@
}
, "autoload": {
"psr-0": {
"Ratchet\\Tests": "tests"
, "Ratchet": "src"
"Ratchet": "src"
}
}
, "require": {

10
composer.lock generated
View File

@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "d5a238bcdccc33fab13dd3c65b663beb",
"hash": "f5d2fe5b143f2c5d2e8f674dd2f6bc16",
"packages": [
{
"name": "evenement/evenement",
@ -429,17 +429,17 @@
},
{
"name": "symfony/http-foundation",
"version": "v2.3.0",
"version": "v2.3.1",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
"reference": "v2.3.0-RC1"
"reference": "v2.3.1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.3.0-RC1",
"reference": "v2.3.0-RC1",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.3.1",
"reference": "v2.3.1",
"shasum": ""
},
"require": {

View File

@ -2,7 +2,7 @@
<phpunit
forceCoversAnnotation="true"
mapTestClassNameToCoveredClassName="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
@ -11,15 +11,14 @@
>
<testsuites>
<testsuite name="Ratchet Test Suite">
<directory>./tests/Ratchet/</directory>
<testsuite name="unit">
<directory>./tests/unit/</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory>./tests/</directory>
<directory>./vendor/</directory>
</blacklist>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>

5
tests/bootstrap.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$loader = require __DIR__ . '/../vendor/autoload.php';
$loader->add('Ratchet', __DIR__ . '/helpers');
$loader->register();

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests;
namespace Ratchet;
abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase {
protected $_app;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Mock;
namespace Ratchet\Mock;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Mock;
namespace Ratchet\Mock;
use Ratchet\ConnectionInterface;
class Connection implements ConnectionInterface {

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Mock;
namespace Ratchet\Mock;
use Ratchet\AbstractConnectionDecorator;
class ConnectionDecorator extends AbstractConnectionDecorator {

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Mock;
namespace Ratchet\Mock;
use Ratchet\Wamp\WampServerInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Mock;
namespace Ratchet;
use Ratchet\ConnectionInterface;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Wamp\Stub;
namespace Ratchet\Wamp\Stub;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\Wamp\WampServerInterface;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Stub;
namespace Ratchet\WebSocket\Stub;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;

View File

@ -1,6 +1,6 @@
<?php
namespace Ratchet\Tests;
use Ratchet\Tests\Mock\ConnectionDecorator;
namespace Ratchet;
use Ratchet\Mock\ConnectionDecorator;
/**
* @covers Ratchet\AbstractConnectionDecorator

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Http\Guzzle\Http\Message;
namespace Ratchet\Http\Guzzle\Http\Message;
use Ratchet\Http\Guzzle\Http\Message\RequestFactory;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Http;
namespace Ratchet\Http;
use Ratchet\Http\HttpRequestParser;
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Ratchet\Tests\Http;
use Ratchet\Tests\AbstractMessageComponentTestCase;
namespace Ratchet\Http;
use Ratchet\AbstractMessageComponentTestCase;
/**
* @covers Ratchet\Http\HttpServer

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Http;
namespace Ratchet\Http;
use Ratchet\Http\Router;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Server;
namespace Ratchet\Server;
use Ratchet\Server\EchoServer;
class EchoServerTest extends \PHPUnit_Framework_TestCase {

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Application\Server;
namespace Ratchet\Application\Server;
use Ratchet\Server\FlashPolicy;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Application\Server;
namespace Ratchet\Application\Server;
use Ratchet\Server\IoConnection;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Server;
namespace Ratchet\Server;
use Ratchet\Server\IoServer;
use React\EventLoop\StreamSelectLoop;
use React\Socket\Server;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Server;
namespace Ratchet\Server;
use Ratchet\Server\IpBlackList;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Session\Serialize;
namespace Ratchet\Session\Serialize;
use Ratchet\Session\Serialize\PhpHandler;
/**

View File

@ -1,8 +1,8 @@
<?php
namespace Ratchet\Tests\Session;
use Ratchet\Tests\AbstractMessageComponentTestCase;
namespace Ratchet\Session;
use Ratchet\AbstractMessageComponentTestCase;
use Ratchet\Session\SessionProvider;
use Ratchet\Tests\Mock\MemorySessionHandler;
use Ratchet\Mock\MemorySessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
use Guzzle\Http\Message\Request;
@ -31,7 +31,7 @@ class SessionProviderTest extends AbstractMessageComponentTestCase {
}
public function getDecoratorClassString() {
return '\Ratchet\Tests\Mock\NullComponent';
return '\Ratchet\NullComponent';
}
public function getComponentClassString() {
@ -119,7 +119,7 @@ class SessionProviderTest extends AbstractMessageComponentTestCase {
}
public function testGetSubProtocolsGetFromApp() {
$mock = $this->getMock('Ratchet\\Tests\\WebSocket\\Stub\\WsMessageComponentInterface');
$mock = $this->getMock('Ratchet\WebSocket\Stub\WsMessageComponentInterface');
$mock->expects($this->once())->method('getSubProtocols')->will($this->returnValue(array('hello', 'world')));
$comp = new SessionProvider($mock, new NullSessionHandler);

View File

@ -1,9 +1,9 @@
<?php
namespace Ratchet\Tests\Wamp;
namespace Ratchet\Wamp;
use Ratchet\Wamp\ServerProtocol;
use Ratchet\Wamp\WampConnection;
use Ratchet\Tests\Mock\Connection;
use Ratchet\Tests\Mock\WampComponent as TestComponent;
use Ratchet\Mock\Connection;
use Ratchet\Mock\WampComponent as TestComponent;
/**
* @covers Ratchet\Wamp\ServerProtocol

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Wamp;
namespace Ratchet\Wamp;
use Ratchet\Wamp\TopicManager;
/**
@ -20,7 +20,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function setUp() {
$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->conn->WAMP = new \StdClass;
@ -28,19 +28,19 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
}
public function testGetTopicReturnsTopicObject() {
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array('The Topic'));
$this->assertInstanceOf('Ratchet\\Wamp\\Topic', $topic);
$this->assertInstanceOf('Ratchet\Wamp\Topic', $topic);
}
public function testGetTopicCreatesTopicWithSameName() {
$name = 'The Topic';
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
@ -50,7 +50,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
}
public function testGetTopicReturnsSameObject() {
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
@ -71,7 +71,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$this->mock->expects($this->once())->method('onCall')->with(
$this->conn
, $id
, $this->isInstanceOf('Ratchet\\Wamp\\Topic')
, $this->isInstanceOf('Ratchet\Wamp\Topic')
, array()
);
@ -80,7 +80,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testOnSubscribeCreatesTopicObject() {
$this->mock->expects($this->once())->method('onSubscribe')->with(
$this->conn, $this->isInstanceOf('Ratchet\\Wamp\\Topic')
$this->conn, $this->isInstanceOf('Ratchet\Wamp\Topic')
);
$this->mngr->onSubscribe($this->conn, 'new topic');
@ -89,7 +89,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testTopicIsInConnectionOnSubscribe() {
$name = 'New Topic';
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
@ -110,7 +110,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testUnsubscribeEvent() {
$name = 'in and out';
$this->mock->expects($this->once())->method('onUnsubscribe')->with(
$this->conn, $this->isInstanceOf('Ratchet\\Wamp\\Topic')
$this->conn, $this->isInstanceOf('Ratchet\Wamp\Topic')
);
$this->mngr->onSubscribe($this->conn, $name);
@ -129,7 +129,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testUnsubscribeRemovesTopicFromConnection() {
$name = 'Bye Bye Topic';
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
@ -146,7 +146,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
$this->mock->expects($this->once())->method('onPublish')->with(
$this->conn
, $this->isInstanceOf('Ratchet\\Wamp\\Topic')
, $this->isInstanceOf('Ratchet\Wamp\Topic')
, $msg
, $this->isType('array')
, $this->isType('array')
@ -163,7 +163,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testConnIsRemovedFromTopicOnClose() {
$name = 'State testing';
$class = new \ReflectionClass('Ratchet\\Wamp\\TopicManager');
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
@ -188,7 +188,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
public function testGetSubProtocolsBubbles() {
$subs = array('hello', 'world');
$app = $this->getMock('Ratchet\\Tests\\Wamp\\Stub\\WsWampServerInterface');
$app = $this->getMock('Ratchet\Wamp\Stub\WsWampServerInterface');
$app->expects($this->once())->method('getSubProtocols')->will($this->returnValue($subs));
$mngr = new TopicManager($app);

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Wamp;
namespace Ratchet\Wamp;
use Ratchet\Wamp\Topic;
use Ratchet\Wamp\WampConnection;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\Wamp;
namespace Ratchet\Wamp;
use Ratchet\Wamp\WampConnection;
/**

View File

@ -1,7 +1,7 @@
<?php
namespace Ratchet\Tests\Wamp;
namespace Ratchet\Wamp;
use Ratchet\Wamp\WampServer;
use Ratchet\Tests\AbstractMessageComponentTestCase;
use Ratchet\AbstractMessageComponentTestCase;
/**
* @covers Ratchet\Wamp\WampServer

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version;
namespace Ratchet\WebSocket\Version;
use Ratchet\WebSocket\Version\Hixie76;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version;
namespace Ratchet\WebSocket\Version;
use Ratchet\WebSocket\Version\HyBi10;
use Ratchet\WebSocket\Version\RFC6455\Frame;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version\RFC6455;
namespace Ratchet\WebSocket\Version\RFC6455;
use Ratchet\WebSocket\Version\RFC6455\Frame;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version\RFC6455;
namespace Ratchet\WebSocket\Version\RFC6455;
use Ratchet\WebSocket\Version\RFC6455\HandshakeVerifier;
/**

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version\RFC6455\Message;
namespace Ratchet\WebSocket\Version\RFC6455\Message;
use Ratchet\WebSocket\Version\RFC6455\Message;
use Ratchet\WebSocket\Version\RFC6455\Frame;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket\Version;
namespace Ratchet\WebSocket\Version;
use Ratchet\WebSocket\Version\RFC6455;
use Ratchet\WebSocket\Version\RFC6455\Frame;
use Guzzle\Http\Message\RequestFactory;

View File

@ -1,5 +1,5 @@
<?php
namespace Ratchet\Tests\WebSocket;
namespace Ratchet\WebSocket;
use Ratchet\WebSocket\VersionManager;
use Ratchet\WebSocket\Version\RFC6455;
use Ratchet\WebSocket\Version\HyBi10;

View File

@ -1,7 +1,7 @@
<?php
namespace Ratchet\Tests\WebSocket;
namespace Ratchet\WebSocket;
use Ratchet\WebSocket\WsServer;
use Ratchet\Tests\Mock\Component as MockComponent;
use Ratchet\Mock\Component as MockComponent;
/**
* @covers Ratchet\WebSocket\WsServer