HL7
HL7 copied to clipboard
Pass HL7Globals to MSH in ACK
Ensure the HL7 globals are passed to the MSH when creating an ACK message. Part of #22
Can you please add tests?
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));
}
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.