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
				
			
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace mfmdevsystem\socket\Wamp;
 | |
| use mfmdevsystem\socket\AbstractMessageComponentTestCase;
 | |
| 
 | |
| /**
 | |
|  * @covers Ratchet\Wamp\WampServer
 | |
|  */
 | |
| class WampServerTest extends AbstractMessageComponentTestCase {
 | |
|     public function getConnectionClassString() {
 | |
|         return '\Ratchet\Wamp\WampConnection';
 | |
|     }
 | |
| 
 | |
|     public function getDecoratorClassString() {
 | |
|         return 'Ratchet\Wamp\WampServer';
 | |
|     }
 | |
| 
 | |
|     public function getComponentClassString() {
 | |
|         return '\Ratchet\Wamp\WampServerInterface';
 | |
|     }
 | |
| 
 | |
|     public function testOnMessageToEvent() {
 | |
|         $published = 'Client published this message';
 | |
| 
 | |
|         $this->_app->expects($this->once())->method('onPublish')->with(
 | |
|             $this->isExpectedConnection()
 | |
|           , new \PHPUnit_Framework_Constraint_IsInstanceOf('\Ratchet\Wamp\Topic')
 | |
|           , $published
 | |
|           , array()
 | |
|           , array()
 | |
|         );
 | |
| 
 | |
|         $this->_serv->onMessage($this->_conn, json_encode(array(7, 'topic', $published)));
 | |
|     }
 | |
| 
 | |
|     public function testGetSubProtocols() {
 | |
|         // todo: could expand on this
 | |
|         $this->assertInternalType('array', $this->_serv->getSubProtocols());
 | |
|     }
 | |
| 
 | |
|     public function testConnectionClosesOnInvalidJson() {
 | |
|         $this->_conn->expects($this->once())->method('close');
 | |
|         $this->_serv->onMessage($this->_conn, 'invalid json');
 | |
|     }
 | |
| 
 | |
|     public function testConnectionClosesOnProtocolError() {
 | |
|         $this->_conn->expects($this->once())->method('close');
 | |
|         $this->_serv->onMessage($this->_conn, json_encode(array('valid' => 'json', 'invalid' => 'protocol')));
 | |
|     }
 | |
| }
 |