Unit testing coverage
This commit is contained in:
parent
2811cdbd48
commit
04875dadcd
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
phpunit.xml
|
||||
coverage
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace Ratchet\Protocol;
|
||||
use Ratchet\Server;
|
||||
use Ratchet\ServerInterface;
|
||||
|
||||
interface ProtocolInterface {
|
||||
function __construct(Server $server);
|
||||
interface ProtocolInterface extends ServerInterface {
|
||||
}
|
@ -3,10 +3,13 @@ namespace Ratchet\Protocol\WebSocket;
|
||||
use Ratchet\ServerInterface;
|
||||
use Ratchet\Protocol\ProtocolInterface;
|
||||
|
||||
class Server implements ServerInterface, ProtocolInterface {
|
||||
class Server implements ProtocolInterface {
|
||||
protected $_server = null;
|
||||
|
||||
public function __construct(ServerInterface $server) {
|
||||
$this->_server = $server;
|
||||
}
|
||||
|
||||
public function run() {
|
||||
}
|
||||
}
|
26
tests/Ratchet/Tests/Protocol/WebSocket/ServerTest.php
Normal file
26
tests/Ratchet/Tests/Protocol/WebSocket/ServerTest.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Ratchet\Tests\Protocol\WebSocket;
|
||||
use Ratchet\Server;
|
||||
use Ratchet\Protocol\WebSocket\Server as WebServer;
|
||||
use Ratchet\Tests\Mock\Socket;
|
||||
|
||||
/**
|
||||
* @covers Ratchet\Protocol\WebSocket\Server
|
||||
*/
|
||||
class ServerTest extends \PHPUnit_Framework_TestCase {
|
||||
protected $_server;
|
||||
|
||||
public function setUp() {
|
||||
$this->_server = new WebServer(new Server(new Socket()));
|
||||
}
|
||||
|
||||
public function testServerImplementsServerInterface() {
|
||||
$constraint = $this->isInstanceOf('\\Ratchet\\ServerInterface');
|
||||
$this->assertThat($this->_server, $constraint);
|
||||
}
|
||||
|
||||
public function testServerImplementsProtocolInterface() {
|
||||
$constraint = $this->isInstanceOf('\\Ratchet\\Protocol\ProtocolInterface');
|
||||
$this->assertThat($this->_server, $constraint);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user