Ejemplo n.º 1
0
 public function __construct(Queue\Client $queue, $data)
 {
     $store = $queue->getStore()->getMessagesStore();
     $this->promisesStore = $queue->getStore()->getPromisesStore();
     $promise = new PromiseClient($this->promisesStore);
     $data = is_null($data) ? [Store::QUEUE_ID => $queue->getId(), Store::PROMISE => $promise->getId()] : is_array($data) ? array_merge($data, [Store::QUEUE_ID => $queue->getId(), Store::PROMISE => $promise->getId()]) : $data;
     parent::__construct($store, $data);
     $this->queue = $queue;
 }
Ejemplo n.º 2
0
 public function test_MessageTest__make()
 {
     $this->object = new Client($this->queueClient, [Store::MESSAGE_BODY => 'body']);
     $this->assertInstanceOf('zaboy\\async\\Message\\Client', $this->object);
     $this->assertTrue($this->object->isId($this->object->getId()));
     $this->assertEquals('body', $this->object->getBody());
     $this->assertEquals(1, $this->object->getStore()->count([Store::QUEUE_ID => $this->queueClient->getId()]));
     $this->object->remove();
     $this->assertEquals(0, $this->queueClient->getNumberMessages());
 }
Ejemplo n.º 3
0
 public function test_QueueTest__makeWithoutName()
 {
     $this->object = new Client($this->store);
     $this->assertInstanceOf('zaboy\\async\\Queue\\Client', $this->object);
     $this->assertEquals(md5($this->object->getId()), $this->object->getName());
 }