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
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
namespace mfmdevsystem\socket\Http;
|
|
use mfmdevsystem\socket\AbstractMessageComponentTestCase;
|
|
|
|
/**
|
|
* @covers Ratchet\Http\OriginCheck
|
|
*/
|
|
class OriginCheckTest extends AbstractMessageComponentTestCase {
|
|
protected $_reqStub;
|
|
|
|
public function setUp() {
|
|
$this->_reqStub = $this->getMock('Psr\Http\Message\RequestInterface');
|
|
$this->_reqStub->expects($this->any())->method('getHeader')->will($this->returnValue(['localhost']));
|
|
|
|
parent::setUp();
|
|
|
|
$this->_serv->allowedOrigins[] = 'localhost';
|
|
}
|
|
|
|
protected function doOpen($conn) {
|
|
$this->_serv->onOpen($conn, $this->_reqStub);
|
|
}
|
|
|
|
public function getConnectionClassString() {
|
|
return '\Ratchet\ConnectionInterface';
|
|
}
|
|
|
|
public function getDecoratorClassString() {
|
|
return '\Ratchet\Http\OriginCheck';
|
|
}
|
|
|
|
public function getComponentClassString() {
|
|
return '\Ratchet\Http\HttpServerInterface';
|
|
}
|
|
|
|
public function testCloseOnNonMatchingOrigin() {
|
|
$this->_serv->allowedOrigins = ['socketo.me'];
|
|
$this->_conn->expects($this->once())->method('close');
|
|
|
|
$this->_serv->onOpen($this->_conn, $this->_reqStub);
|
|
}
|
|
|
|
public function testOnMessage() {
|
|
$this->passthroughMessageTest('Hello World!');
|
|
}
|
|
}
|