/**
  * @test
  */
 public function it_collects_the_oldest_user_by_using_order_by_age()
 {
     $taskListPosition = TaskListPosition::at(TaskListId::linkWith(NodeName::defaultName(), ProcessId::generate()), 1);
     $metadata = ['order_by' => 'age DESC'];
     $message = WorkflowMessage::collectDataOf(TestUser::prototype(), 'test-case', 'localhost', $metadata);
     $message->connectToProcessTask($taskListPosition);
     $this->tableGateway->handleWorkflowMessage($message);
     $this->assertInstanceOf('Prooph\\Processing\\Message\\WorkflowMessage', $this->messageReceiver->getLastReceivedMessage());
     /** @var $wfMessage WorkflowMessage */
     $wfMessage = $this->messageReceiver->getLastReceivedMessage();
     $user = $wfMessage->payload()->toType();
     $this->assertInstanceOf('ProophTest\\Link\\SqlConnector\\DataType\\TestUser', $user);
     $this->assertEquals('Donald Duck', $user->property('name')->value());
 }
 /**
  * Returns the prototype of the items type
  *
  * A collection has always one property with name item representing the type of all items in the collection.
  *
  * @return Prototype
  */
 public static function itemPrototype()
 {
     return TestUser::prototype();
 }