SoapServer/Client now handle binary files correctly & large tests/fixtures update

Soap Server and Client were breaking binary files during transfer due to invalid Mime Message Parser. Now is it working fine with no errors, but the message parser is about to be rewritten into a better form.
This commit is contained in:
Petr Bechyně
2017-04-04 18:36:18 +02:00
parent 311f9e6d08
commit 564005da93
42 changed files with 1135 additions and 250 deletions

View File

@ -34,6 +34,10 @@ class DummyService implements AttachmentsHandlerInterface
'DummyServiceResponseWithAttachments' => DummyServiceResponseWithAttachments::class,
'DummyServiceRequest' => DummyServiceRequest::class,
'DummyServiceRequestWithAttachments' => DummyServiceRequestWithAttachments::class,
'DummyServiceMethodWithOutgoingLargeSwaRequest' => DummyServiceMethodWithOutgoingLargeSwaRequest::class,
'DummyServiceMethodWithOutgoingLargeSwaResponse' => DummyServiceMethodWithOutgoingLargeSwaResponse::class,
'DummyServiceMethodWithIncomingLargeSwaRequest' => DummyServiceMethodWithIncomingLargeSwaRequest::class,
'DummyServiceMethodWithIncomingLargeSwaResponse' => DummyServiceMethodWithIncomingLargeSwaResponse::class,
];
}
@ -67,6 +71,54 @@ class DummyService implements AttachmentsHandlerInterface
return $dummyServiceHandler->handle($dummyServiceRequest);
}
/**
* @param DummyServiceMethodWithOutgoingLargeSwaRequest $dummyServiceRequest
* @return DummyServiceMethodWithOutgoingLargeSwaResponse
*/
public function dummyServiceMethodWithOutgoingLargeSwa(DummyServiceMethodWithOutgoingLargeSwaRequest $dummyServiceRequest)
{
$dummyServiceHandler = new DummyServiceHandlerWithOutgoingLargeSwa();
$dummyServiceResponseWithAttachments = $dummyServiceHandler->handle($dummyServiceRequest);
if ($dummyServiceResponseWithAttachments->hasAttachments() === true) {
$soapAttachments = [];
foreach ($dummyServiceResponseWithAttachments->attachmentCollection->attachments as $attachment) {
$soapAttachments[] = new SoapAttachment(
$attachment->fileName,
$attachment->contentType,
$attachment->content
);
}
$this->addAttachmentStorage(new RequestHandlerAttachmentsStorage($soapAttachments));
}
return $dummyServiceResponseWithAttachments;
}
/**
* @param DummyServiceMethodWithIncomingLargeSwaRequest $dummyServiceRequest
* @return DummyServiceMethodWithIncomingLargeSwaResponse
*/
public function dummyServiceMethodWithIncomingLargeSwa(DummyServiceMethodWithIncomingLargeSwaRequest $dummyServiceRequest)
{
$dummyServiceHandler = new DummyServiceHandlerWithIncomingLargeSwa();
$attachmentStorageContents = $this->getAttachmentStorage()->getAttachments();
if (count($attachmentStorageContents) > 0) {
$attachments = [];
foreach ($attachmentStorageContents as $soapAttachment) {
$attachments[] = new Attachment(
$soapAttachment->getId(),
$soapAttachment->getType(),
$soapAttachment->getContent()
);
}
$dummyServiceRequest->attachmentCollection = new AttachmentCollection($attachments);
}
return $dummyServiceHandler->handle($dummyServiceRequest);
}
/**
* @param DummyServiceRequestWithAttachments $dummyServiceRequestWithAttachments
* @return DummyServiceResponseWithAttachments