Ejemplo n.º 1
0
 /**
  * Test produce method
  *
  * @param string $url
  * @param string $topic
  * @param string $producerId
  * @param string $body
  * @param string $accessKey
  * @param string $accessSecret
  * @dataProvider getMessageQueueInfo
  */
 public function testProduce($url, $topic, $producerId, $body, $accessKey, $accessSecret)
 {
     $authorization = new Authorization($accessKey, $accessSecret);
     $producer = new Producer($url, $authorization);
     $message = new Message();
     $message->setBody($body);
     $response = $producer->produce($topic, $producerId, $message);
     $this->assertTrue($response->isSuccessful());
 }
Ejemplo n.º 2
0
 /**
  * Make signature for authorized request
  *
  * @return string
  */
 public function getSignature()
 {
     $signString = sprintf("%s\n%s\n%s\n%d", $this->topic, $this->consumerId, $this->message->getMessageHandle(), $this->time);
     return base64_encode(hash_hmac('sha1', $signString, $this->getAuthorization()->getAccessSecret(), true));
 }
Ejemplo n.º 3
0
 /**
  * Test Message
  *
  * @param string $responseString
  * @param array $realInfo
  * @dataProvider getServerResponseString
  */
 public function testMessage($responseString, $realInfo)
 {
     $messages = json_decode($responseString, true);
     $message = new Message($messages[0]);
     $this->assertEquals($message->toArray(), $realInfo);
 }