5 require_once(
'./libs/composer/vendor/autoload.php');
40 $this->httpServiceMock = Mockery::mock(HTTPServices::class);
41 $this->httpServiceMock->shouldIgnoreMissing();
46 require_once
'./Services/FileDelivery/classes/FileDeliveryTypes/XSendfile.php';
55 $expectedHeader =
'X-Sendfile';
58 $response = Mockery::mock(ResponseInterface::class);
59 $response->shouldIgnoreMissing()->shouldReceive(
"withHeader")->times(1)
60 ->withArgs([ $expectedHeader, $filePath ])->andReturnSelf();
62 $this->httpServiceMock->shouldReceive(
"response")->times(1)->withNoArgs()
63 ->andReturn(
$response)->getMock()->shouldReceive(
"saveResponse")
64 ->times(1)->withArgs([
$response ])->getMock()
65 ->shouldReceive(
"sendResponse")->times(1)->withNoArgs();
67 $fileDeliveryType =
new XSendfile($this->httpServiceMock);
68 $fileDeliveryOk = $fileDeliveryType->deliver($filePath,
false);
70 $this->assertTrue($fileDeliveryOk);
testSendFileWithXSendHeaderWhichShouldSucceed()