10 require_once(
'./libs/composer/vendor/autoload.php');
42 $this->httpServiceMock = Mockery::mock(GlobalHttpState::class);
43 $this->httpServiceMock->shouldIgnoreMissing();
48 require_once
'./Services/FileDelivery/classes/FileDeliveryTypes/XAccel.php';
57 $expectedContentValue =
'';
59 $response = Mockery::mock(ResponseInterface::class);
60 $response->shouldIgnoreMissing()->shouldReceive(
"withHeader")->times(1)
64 $this->httpServiceMock->shouldReceive(
"response")->times(1)->withNoArgs()
65 ->andReturn(
$response)->getMock()->shouldReceive(
"saveResponse")
68 $xAccel =
new XAccel($this->httpServiceMock);
69 $result = $xAccel->prepare(
"this path is never used in this method");
80 $expectedHeader =
'X-Accel-Redirect';
81 $path =
'./normal/path';
83 $response = Mockery::mock(ResponseInterface::class);
84 $response->shouldIgnoreMissing()->shouldReceive(
"withHeader")->times(1)
85 ->withArgs([ $expectedHeader,
$path ])->andReturnSelf();
87 $this->httpServiceMock->shouldReceive(
"response")->times(1)->withNoArgs()
88 ->andReturn(
$response)->getMock()->shouldReceive(
"saveResponse")
89 ->times(1)->withArgs([
$response ])->getMock()
90 ->shouldReceive(
"sendResponse")->times(1)->withNoArgs();
92 $xAccel =
new XAccel($this->httpServiceMock);
93 $xAccel->deliver(
$path,
false);
102 $expectedHeader =
'X-Accel-Redirect';
103 $path =
'./data/path/to/what/ever';
104 $expectedPath =
'/secured-data/path/to/what/ever';
106 $response = Mockery::mock(ResponseInterface::class);
107 $response->shouldIgnoreMissing()->shouldReceive(
"withHeader")->times(1)
108 ->withArgs([ $expectedHeader, $expectedPath ])->andReturnSelf();
110 $this->httpServiceMock->shouldReceive(
"response")->times(1)->withNoArgs()
111 ->andReturn(
$response)->getMock()->shouldReceive(
"saveResponse")
112 ->times(1)->withArgs([
$response ])->getMock()
113 ->shouldReceive(
"sendResponse")->times(1)->withNoArgs();
115 $xAccel =
new XAccel($this->httpServiceMock);
116 $xAccel->deliver(
$path,
false);
testDeliverWithDataPathWhichShouldSucceed()
testPrepareWhichShouldSucceed()
testDeliverWithNormalPathWhichShouldSucceed()