/** * Test consume_all_queues using SimpleDB. We use a counter static method * and count the number of times its called, for messages on multiple * calls. */ function testMultipleConsume() { MessageQueue::add_interface("default", array("queues" => array("testmainqueue1", "testmainqueue2", "testmainqueue3"), "implementation" => "SimpleDBMQ", "encoding" => "php_serialize", "send" => array("onShutdown" => "none"), "delivery" => array("onerror" => array("requeue")))); $this->assertTrue($this->getQueueSizeSimpleDB("testmainqueue1") == 0, "Queue 1 is empty before we put anything in it"); $this->assertTrue($this->getQueueSizeSimpleDB("testmainqueue2") == 0, "Queue 2 is empty before we put anything in it"); $this->assertTrue($this->getQueueSizeSimpleDB("testmainqueue3") == 0, "Queue 3 is empty before we put anything in it"); self::$countedCalls = 0; MessageQueue::send("testmainqueue1", new MethodInvocationMessage("MessageQueueTest", "doCountCalls")); MessageQueue::send("testmainqueue2", new MethodInvocationMessage("MessageQueueTest", "doCountCalls")); MessageQueue::send("testmainqueue3", new MethodInvocationMessage("MessageQueueTest", "doCountCalls")); $this->assertTrue(MessageQueue::consume_all_queues("default") == 3, "Consumed messages off 3 queues"); $this->assertTrue(self::$countedCalls == 3, "3 messages were delivered"); }