Unit testing coverage

This commit is contained in:
Chris Boden 2011-09-04 20:47:43 -04:00
parent 2811cdbd48
commit 04875dadcd
4 changed files with 34 additions and 4 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
phpunit.xml
coverage

View File

@ -1,7 +1,6 @@
<?php
namespace Ratchet\Protocol;
use Ratchet\Server;
use Ratchet\ServerInterface;
interface ProtocolInterface {
function __construct(Server $server);
interface ProtocolInterface extends ServerInterface {
}

View File

@ -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() {
}
}

View 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);
}
}