mxmbsocket/tests/unit/Server/IoConnectionTest.php
Mohamad Faeez 50725bbf4c
Some checks are pending
CI / PHPUnit (highest, 5.4) (push) Waiting to run
CI / PHPUnit (highest, 5.5) (push) Waiting to run
CI / PHPUnit (highest, 5.6) (push) Waiting to run
CI / PHPUnit (highest, 7.0) (push) Waiting to run
CI / PHPUnit (highest, 7.1) (push) Waiting to run
CI / PHPUnit (highest, 7.2) (push) Waiting to run
CI / PHPUnit (highest, 7.3) (push) Waiting to run
CI / PHPUnit (highest, 7.4) (push) Waiting to run
CI / PHPUnit (lowest, 5.4) (push) Waiting to run
major update
2025-04-09 14:56:59 +08:00

33 lines
891 B
PHP

<?php
namespace mfmdevsystem\socket\Application\Server;
use mfmdevsystem\socket\Server\IoConnection;
/**
* @covers Ratchet\Server\IoConnection
*/
class IoConnectionTest extends \PHPUnit_Framework_TestCase {
protected $sock;
protected $conn;
public function setUp() {
$this->sock = $this->getMock('\\React\\Socket\\ConnectionInterface');
$this->conn = new IoConnection($this->sock);
}
public function testCloseBubbles() {
$this->sock->expects($this->once())->method('end');
$this->conn->close();
}
public function testSendBubbles() {
$msg = '6 hour rides are productive';
$this->sock->expects($this->once())->method('write')->with($msg);
$this->conn->send($msg);
}
public function testSendReturnsSelf() {
$this->assertSame($this->conn, $this->conn->send('fluent interface'));
}
}