示例#1
0
 public function testGetSetMessageClass()
 {
     //test default value
     $this->assertSame(Message::class, $this->options->getMessageClass());
     $this->assertInstanceOf(QueueOptions::class, $this->options->setMessageClass('foo'));
     $this->assertSame('foo', $this->options->getMessageClass());
 }
示例#2
0
 public function testQueueMessageTest()
 {
     $options = new QueueOptions();
     $this->assertEquals(Message::class, $options->getMessageClass());
     $queue = $this->createQueue(__FUNCTION__, $options);
     $adapter = $queue->getAdapter();
     $this->checkAdapterSupport('deleteQueue');
     $body = 'this is a test message';
     $message = new Message();
     $message->setContent($body);
     $queue->send($message);
     $this->assertTrue($message instanceof Message);
     $list = $queue->receive();
     $this->assertTrue($list instanceof MessageIterator);
     foreach ($list as $i => $message) {
         $this->assertTrue($message instanceof Message);
         if ($adapter instanceof DeleteMessageCapableInterface) {
             $queue->delete($message);
         }
     }
     // delete the queue we created
     $adapter->deleteQueue($queue->getName());
 }