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()); }
public function test_QueueTest__pullMessage() { $this->object = new Client($this->store); $message = $this->object->addMessage('body'); $promise = $message->getPromise(); $resolvedBodyPromise = $promise->then(function ($body) { return $body . ' resolved'; }); $this->assertEquals(1, $this->object->getNumberMessages()); $body = $this->object->pullMessage(); $this->assertEquals(0, $this->object->getNumberMessages()); $this->assertEquals('body', $body); $this->assertEquals('body resolved', $resolvedBodyPromise->wait(true)); }