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
27 lines
826 B
PHP
27 lines
826 B
PHP
<?php
|
|
namespace mfmdevsystem\socket\Server;
|
|
use mfmdevsystem\socket\Server\EchoServer;
|
|
|
|
class EchoServerTest extends \PHPUnit_Framework_TestCase {
|
|
protected $_conn;
|
|
protected $_comp;
|
|
|
|
public function setUp() {
|
|
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
|
|
$this->_comp = new EchoServer;
|
|
}
|
|
|
|
public function testMessageEchod() {
|
|
$message = 'Tillsonburg, my back still aches when I hear that word.';
|
|
$this->_conn->expects($this->once())->method('send')->with($message);
|
|
$this->_comp->onMessage($this->_conn, $message);
|
|
}
|
|
|
|
public function testErrorClosesConnection() {
|
|
ob_start();
|
|
$this->_conn->expects($this->once())->method('close');
|
|
$this->_comp->onError($this->_conn, new \Exception);
|
|
ob_end_clean();
|
|
}
|
|
}
|