Пример #1
0
 public function test_parameters()
 {
     $frame = new Stomp\Frame();
     try {
         $frame->setAutoContentLength(array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->setHeader(array(), 1);
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->setHeader('testing', array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->getHeader(array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->setBody(array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->setCommand(array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->toFrame();
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     try {
         $frame->fromFrame(array());
         $this->fail('Exception should have been thrown');
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
 }
Пример #2
0
 public function testByteMessageAutoContentLengthOn()
 {
     $frame = new Frame();
     $frame->setCommand('TESTING');
     $frame->setAutoContentLength(true);
     $frame->setBody('hello ' . Frame::END_OF_FRAME . ' world');
     $connection = new ConnectionSocketOverload();
     $connection->setSocket($this->_socket);
     $connection->write($frame);
     rewind($this->_socket);
     $test = $connection->read();
     $this->assertEquals('hello ' . Frame::END_OF_FRAME . ' world', $test->getBody());
 }