Permalink
Browse files

Add server test for close()

  • Loading branch information...
igorw committed Apr 22, 2012
1 parent 455dde9 commit 4ab7331aad83650ea75dc9830cbdf631c5212140
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/Igorw/Tests/SocketServer/ServerTest.php
@@ -162,6 +162,25 @@ public function testInput()
$this->server->tick();
}
+ /**
+ * @covers Igorw\SocketServer\Server::tick
+ * @covers Igorw\SocketServer\Server::close
+ */
+ public function testClose()
+ {
+ $client = stream_socket_client('tcp://localhost:'.$this->port);
+ $this->server->tick();
+
+ $this->assertCount(1, $this->server->getClients());
+
+ $conns = $this->server->getClients();
+ list($key, $conn) = each($conns);
+
+ $conn->close();
+
+ $this->assertCount(0, $this->server->getClients());
+ }
+
/**
* @covers Igorw\SocketServer\Server::tick
* @covers Igorw\SocketServer\Server::getClients

0 comments on commit 4ab7331

Please sign in to comment.