1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/cboden/ratchet/tests/unit/Http/OriginCheckTest.php
DanielnetoDotCom 730f4893f2 Adding socket support
-- When upload a video to a certain category, this video will be part of a user group automatically
-- one category can add your video in more than one user group
-- Allow user add some extra info in JSON format, for example bank info and other thing
-- This is based on users_extra_info table 
-- add full text search https://github.com/WWBN/AVideo/issues/4343
2021-01-14 14:24:07 -03:00

46 lines
1.2 KiB
PHP

<?php
namespace Ratchet\Http;
use Ratchet\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!');
}
}