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
				
			
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace mfmdevsystem\socket\Http;
 | |
| 
 | |
| /**
 | |
|  * @covers Ratchet\Http\HttpRequestParser
 | |
|  */
 | |
| class HttpRequestParserTest extends \PHPUnit_Framework_TestCase {
 | |
|     protected $parser;
 | |
| 
 | |
|     public function setUp() {
 | |
|         $this->parser = new HttpRequestParser;
 | |
|     }
 | |
| 
 | |
|     public function headersProvider() {
 | |
|         return array(
 | |
|             array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n")
 | |
|           , array(true,  "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n")
 | |
|           , array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n1")
 | |
|           , array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖")
 | |
|           , array(true,  "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖\r\n\r\n")
 | |
|           , array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie\r\n")
 | |
|         );
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @dataProvider headersProvider
 | |
|      */
 | |
|     public function testIsEom($expected, $message) {
 | |
|         $this->assertEquals($expected, $this->parser->isEom($message));
 | |
|     }
 | |
| 
 | |
|     public function testBufferOverflowResponse() {
 | |
|         $conn = $this->getMock('\Ratchet\ConnectionInterface');
 | |
| 
 | |
|         $this->parser->maxSize = 20;
 | |
| 
 | |
|         $this->assertNull($this->parser->onMessage($conn, "GET / HTTP/1.1\r\n"));
 | |
| 
 | |
|         $this->setExpectedException('OverflowException');
 | |
| 
 | |
|         $this->parser->onMessage($conn, "Header-Is: Too Big");
 | |
|     }
 | |
| 
 | |
|     public function testReturnTypeIsRequest() {
 | |
|         $conn = $this->getMock('\Ratchet\ConnectionInterface');
 | |
|         $return = $this->parser->onMessage($conn, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n");
 | |
| 
 | |
|         $this->assertInstanceOf('\Psr\Http\Message\RequestInterface', $return);
 | |
|     }
 | |
| }
 |