HL7 icon indicating copy to clipboard operation
HL7 copied to clipboard

Pass HL7Globals to MSH in ACK

Open pluk77 opened this issue 3 years ago • 3 comments

Ensure the HL7 globals are passed to the MSH when creating an ACK message. Part of #22

pluk77 avatar May 26 '21 09:05 pluk77

Can you please add tests?

senaranya avatar Jun 01 '21 05:06 senaranya

I perhaps can, but can you explain the following existing test? Although you pass the HL7 version to the constructor of the ACK message, you are not expecting it to be returned as I do not see the HL7 version in the assertSame() string?

Isn't the whole reason for adding the globals to the constructor so the values are used when creating the message?

   public function globals_can_be_passed_to_constructor(): void
    {
        $msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|");
        $ack = new ACK($msg, null, ['HL7_VERSION' => '2.5']);
        self::assertSame("MSH|^~\&|1||||||ACK|\nMSA|AA|\n", $ack->toString(true));
    }

pluk77 avatar Jun 01 '21 11:06 pluk77

You're absolutely right - the test doesn't check for globals properly. I've replaced it with a proper test. Please rebase your branch on to master to get it.

senaranya avatar Jun 03 '21 04:06 senaranya