public function __construct()
 {
     // spoof a successful connection in the response stack
     $frame = new Zend_Queue_Stomp_Frame();
     $frame->setCommand('CONNECTED');
     $this->responseStack[] = $frame;
 }
Exemple #2
0
 public function test_parameters()
 {
     $frame = new Zend_Queue_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);
     }
 }
 public function testSendAndReceive()
 {
     $frame = new Zend_Queue_Stomp_Frame();
     $frame->setCommand('testing');
     $frame->setHeader('testing', 1);
     $frame->setBody('hello world');
     $client = new Zend_Queue_Stomp_Client();
     $client->addConnection('tcp', 'localhost', '11232', 'Zend_Queue_Stomp_Connection_Mock');
     $client->send($frame);
     $this->assertTrue($client->canRead());
     $test = $client->receive();
     $this->assertEquals('testing', $test->getCommand());
     $this->assertEquals(1, $test->getHeader('testing'));
     $this->assertEquals('hello world', $test->getBody());
 }