/** * @return Message * @throws \RuntimeException */ public function emulateWorkflowMessage() { if ($this->type()->isCollectData()) { $messageType = MessageType::collectData(); } elseif ($this->type()->isProcessData()) { $messageType = MessageType::processData(); } else { throw new \RuntimeException(sprintf("Can't create a message type for task type %s", $this->type()->toString())); } return Message::emulateProcessingWorkflowMessage($messageType, $this->processingType(), $this->metadata()); }
/** * @return Message */ public function toProcessDataMessage() { return self::emulateProcessingWorkflowMessage(MessageType::processData(), $this->processingType(), $this->processingMetadata()); }
/** * @test */ function it_can_be_process_data_type() { $processData = MessageType::processData(); $this->assertTrue($processData->isProcessDataMessage()); $this->assertEquals(MessageType::TYPE_PROCESS_DATA, $processData->toString()); }
function provideMessages() { return [[Message::emulateProcessingWorkflowMessage(MessageType::collectData(), ArticleCollection::prototype(), ProcessingMetadata::noData())], [Message::emulateProcessingWorkflowMessage(MessageType::dataCollected(), ArticleCollection::prototype(), ProcessingMetadata::noData())], [Message::emulateProcessingWorkflowMessage(MessageType::processData(), ArticleCollection::prototype(), ProcessingMetadata::noData())], [Message::emulateProcessingWorkflowMessage(MessageType::dataProcessed(), ArticleCollection::prototype(), ProcessingMetadata::noData())]]; }