Merge pull request #722 from ratchetphp/no-tick-test

Stop using removed tick method
This commit is contained in:
Matt Bonneau 2019-03-10 13:14:50 -04:00 committed by GitHub
commit b85c2a1f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -6,14 +6,9 @@ php:
- 5.6
- 7.0
- 7.1
- hhvm
dist: trusty
matrix:
allow_failures:
- php: hhvm
before_script:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "session.serialize_handler = php" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- php -m

View File

@ -2,6 +2,7 @@
namespace Ratchet\Server;
use Ratchet\Server\IoServer;
use React\EventLoop\StreamSelectLoop;
use React\EventLoop\LoopInterface;
use React\Socket\Server;
/**
@ -16,6 +17,14 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
protected $reactor;
protected function tickLoop(LoopInterface $loop) {
$loop->futureTick(function () use ($loop) {
$loop->stop();
});
$loop->run();
}
public function setUp() {
$this->app = $this->getMock('\\Ratchet\\MessageComponentInterface');
@ -32,7 +41,7 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
$client = stream_socket_client("tcp://localhost:{$this->port}");
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
//$this->assertTrue(is_string($this->app->last['onOpen'][0]->remoteAddress));
//$this->assertTrue(is_int($this->app->last['onOpen'][0]->resourceId));
@ -52,16 +61,16 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
socket_set_block($client);
socket_connect($client, 'localhost', $this->port);
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
socket_write($client, $msg);
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
socket_shutdown($client, 1);
socket_shutdown($client, 0);
socket_close($client);
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
}
public function testOnClose() {
@ -73,13 +82,13 @@ class IoServerTest extends \PHPUnit_Framework_TestCase {
socket_set_block($client);
socket_connect($client, 'localhost', $this->port);
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
socket_shutdown($client, 1);
socket_shutdown($client, 0);
socket_close($client);
$this->server->loop->tick();
$this->tickLoop($this->server->loop);
}
public function testFactory() {