function testMultipleFetch() { $sub1 = $this->backend->subscribe($this->chan->getId()); $sub1->activate(); $sub2 = $this->backend->subscribe($this->chan->getId()); $msg1 = $this->chan->send(1); $sub2->activate(); $msg2 = $this->chan->send(2); $sub3 = $this->backend->subscribe($this->chan->getId()); $sub3->activate(); $msg3 = $this->chan->send(3); $messages = $sub1->fetch(); $this->assertCount(3, $messages, "Sub 1 message count is 3"); $messages = $sub2->fetch(); $this->assertCount(2, $messages, "Sub 2 message count is 3"); // We cannot assert that messages 1 and 2 does not exist anymore since // the delete behavior is not documented at the interface level, we // don't care about that anyway, at least ensure that non fully dequeued // messages are still here $messages = $sub2->fetch(array(Field::MSG_ID => $msg3->getId())); $messages = $sub3->fetch(); $this->assertCount(1, $messages, "Sub 3 message count is 1"); }
/** * Send a message * * @param mixed $contents * Message text * @param string $sender * Sender identifier * @param string $type * Arbitrary business type * @param int $level * Arbitrary business level * * @return MessageInterface */ public function send($contents, $sender, $type = null, $level = 0) { return $this->channel->send($contents, $type, $sender, $level); }