diff --git a/Makefile b/Makefile index 3a1ac95..aa143cc 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/composer.json b/composer.json index a790d55..293c6be 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,7 @@ } , "autoload": { "psr-0": { - "Ratchet\\Tests": "tests" - , "Ratchet": "src" + "Ratchet": "src" } } , "require": { diff --git a/composer.lock b/composer.lock index a803718..1ed2a55 100644 --- a/composer.lock +++ b/composer.lock @@ -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": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 78b3128..117227a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ - - ./tests/Ratchet/ + + ./tests/unit/ - - ./tests/ - ./vendor/ - + + ./src/ + \ No newline at end of file diff --git a/tests/AutobahnTestSuite/bin/fuzzingserver-libev.php b/tests/autobahn/bin/fuzzingserver-libev.php similarity index 100% rename from tests/AutobahnTestSuite/bin/fuzzingserver-libev.php rename to tests/autobahn/bin/fuzzingserver-libev.php diff --git a/tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php b/tests/autobahn/bin/fuzzingserver-libevent.php similarity index 100% rename from tests/AutobahnTestSuite/bin/fuzzingserver-libevent.php rename to tests/autobahn/bin/fuzzingserver-libevent.php diff --git a/tests/AutobahnTestSuite/bin/fuzzingserver-libuv.php b/tests/autobahn/bin/fuzzingserver-libuv.php similarity index 100% rename from tests/AutobahnTestSuite/bin/fuzzingserver-libuv.php rename to tests/autobahn/bin/fuzzingserver-libuv.php diff --git a/tests/AutobahnTestSuite/bin/fuzzingserver-noutf8.php b/tests/autobahn/bin/fuzzingserver-noutf8.php similarity index 100% rename from tests/AutobahnTestSuite/bin/fuzzingserver-noutf8.php rename to tests/autobahn/bin/fuzzingserver-noutf8.php diff --git a/tests/AutobahnTestSuite/bin/fuzzingserver-stream.php b/tests/autobahn/bin/fuzzingserver-stream.php similarity index 100% rename from tests/AutobahnTestSuite/bin/fuzzingserver-stream.php rename to tests/autobahn/bin/fuzzingserver-stream.php diff --git a/tests/AutobahnTestSuite/fuzzingclient-all.json b/tests/autobahn/fuzzingclient-all.json similarity index 100% rename from tests/AutobahnTestSuite/fuzzingclient-all.json rename to tests/autobahn/fuzzingclient-all.json diff --git a/tests/AutobahnTestSuite/fuzzingclient-profile.json b/tests/autobahn/fuzzingclient-profile.json similarity index 100% rename from tests/AutobahnTestSuite/fuzzingclient-profile.json rename to tests/autobahn/fuzzingclient-profile.json diff --git a/tests/AutobahnTestSuite/fuzzingclient-quick.json b/tests/autobahn/fuzzingclient-quick.json similarity index 100% rename from tests/AutobahnTestSuite/fuzzingclient-quick.json rename to tests/autobahn/fuzzingclient-quick.json diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..9d21c77 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,5 @@ +add('Ratchet', __DIR__ . '/helpers'); + $loader->register(); diff --git a/tests/Ratchet/Tests/AbstractMessageComponentTestCase.php b/tests/helpers/Ratchet/AbstractMessageComponentTestCase.php similarity index 98% rename from tests/Ratchet/Tests/AbstractMessageComponentTestCase.php rename to tests/helpers/Ratchet/AbstractMessageComponentTestCase.php index a9223af..990e98c 100644 --- a/tests/Ratchet/Tests/AbstractMessageComponentTestCase.php +++ b/tests/helpers/Ratchet/AbstractMessageComponentTestCase.php @@ -1,5 +1,5 @@ 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); diff --git a/tests/Ratchet/Tests/Wamp/ServerProtocolTest.php b/tests/unit/Wamp/ServerProtocolTest.php similarity index 98% rename from tests/Ratchet/Tests/Wamp/ServerProtocolTest.php rename to tests/unit/Wamp/ServerProtocolTest.php index 4217ea3..9ecd89d 100644 --- a/tests/Ratchet/Tests/Wamp/ServerProtocolTest.php +++ b/tests/unit/Wamp/ServerProtocolTest.php @@ -1,9 +1,9 @@ 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); diff --git a/tests/Ratchet/Tests/Wamp/TopicTest.php b/tests/unit/Wamp/TopicTest.php similarity index 98% rename from tests/Ratchet/Tests/Wamp/TopicTest.php rename to tests/unit/Wamp/TopicTest.php index d5358d1..0a2102b 100644 --- a/tests/Ratchet/Tests/Wamp/TopicTest.php +++ b/tests/unit/Wamp/TopicTest.php @@ -1,5 +1,5 @@