\MessageQueueTest
Synopsis
class MessageQueueTest
extends SapphireTest
{
- // members
- protected static string $fixture_file = 'messagequeue/tests/MessageQueueTest.yml';
- protected array $extraDataObjects = ;
- private static $testP1 = NULL;
- private static $testP2 = NULL;
- private static $message_frame = NULL;
- public static integer $countedCalls = 0;
- public static $saved_interfaces = NULL;
- // methods
- public void testMethodInvocationStatic()
- public void testMethodInvocationObject()
- public void testMethodInvocationDataObject()
- private void getQueueSizeSimpleDB()
- public void testMessageSendDefaultConfig()
- public void testMessageSimpleDBExplicitReceive()
- public void testRequeueOnError()
- public static void doStaticMethodWithError()
- public static void doStaticMethod()
- public void testDropOnError()
- public void testCallbackDelivery()
- public static void messageCallback()
- public void testFrameSend()
- public void testMultipleConsume()
- public void testInterSS()
- public static void doCountCalls()
- public void setUpOnce()
- public void setUp()
- public void tearDownOnce()
Hierarchy
Extends
- SapphireTest
Members
private
-
$message_frame
Our callback function simply stores the message frame it gets so the test can examine it. - $testP1
- $testP2
protected
- $extraDataObjects
- $fixture_file
public
- $countedCalls
- $saved_interfaces
Methods
private
public
- doCountCalls()
- doStaticMethod()
- doStaticMethodWithError() — Static method that throws an exception on delivery if called in a method.
- messageCallback()
- setUp()
- setUpOnce() — Get the existing configuration
- tearDownOnce() — After executing the message queue tests, restore the original queue interfaces.
- testCallbackDelivery() — Test that when a message is delivered by callback, the message disappears off the queue, and the message we get is as we expect.
- testDropOnError()
- testFrameSend() — Send a message that is already a frame. Ensure what we get back is what we sent in the frame.
- testInterSS()
- testMessageSendDefaultConfig() — Test a message send using the default configuration (uses SimpleDBMQ, clears queue on PHP shutdown. Note we need to disable force_immediate_delivery, otherwise the message is not in the queue.
- testMessageSimpleDBExplicitReceive() — Test use of the SimpleDB queue, and with explicitly received message.
- testMethodInvocationDataObject() — Test MethodInvocationMessage class, independent from queueing. Test using data object method.
- testMethodInvocationObject() — Test MethodInvocationMessage class, independent from queueing. Test using object method.
- testMethodInvocationStatic() — Test MethodInvocationMessage class, independent from queueing. Test using static method.
- testMultipleConsume() — 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.
- testRequeueOnError() — This tests a couple of error handling cases. We have 2 queues, testmainqueue and testerrorqueue. We queue a message that will fail on delivery, and another after it which will execute successfully. Error handling is to requeue all errors on testerrorqueue. So we expect that mainqueue is empty after consumption, with the first error going to the error queue, and the second message deliverying successfully. (i.e. error doesn't block messages behind it.