/**
  * @test createMessage creates new message with properties from envelope
  */
 public function copyPropertiesFromEnvelope()
 {
     $properties = ['body' => 'body message', 'headers' => ['x-header-1' => 'value1', 'x-header-2' => 'value2'], 'contentType' => 'application/json', 'contentEncoding' => 'utf-8', 'messageId' => '100', 'appId' => '2', 'userId' => '10', 'priority' => 3, 'timestamp' => strtotime('2012-12-18 09:45:11'), 'expiration' => 1000, 'type' => 'type_str', 'replyTo' => 'foo.bar'];
     $envelope = $this->createEnvelope($properties);
     $message = PeclMessageUtils::createMessage($envelope);
     $this->assertEquals($properties, CustomAmqpMessage::getMessageProperties($message));
 }
 /**
  * @test eventToMessage get properties from prototype
  */
 public function prototypeProperties()
 {
     $prototype = new AmqpMessageMock();
     $converter = new MessageSerializeConverter($this->serializer, $prototype);
     $event = $this->getMock('EventBand\\Event');
     $this->serializer->expects($this->once())->method('serializeEvent')->will($this->returnValue('serialized string'));
     $message = $converter->eventToMessage($event);
     $this->assertInstanceOf('EventBand\\Transport\\Amqp\\Driver\\AmqpMessage', $message);
     $messageProperties = CustomAmqpMessage::getMessageProperties($message);
     $expectedProperties = CustomAmqpMessage::getMessageProperties($prototype);
     $expectedProperties['body'] = 'serialized string';
     $this->assertEquals($expectedProperties, $messageProperties);
 }
 /**
  * @test copied message has same properties
  */
 public function copyMessageProperties()
 {
     $message = new AmqpMessageMock();
     $this->assertEquals(CustomAmqpMessage::getMessageProperties($message), CustomAmqpMessage::getMessageProperties(CustomAmqpMessage::createCopy($message)));
 }