19 declare(strict_types=1);
54 protected function setUp(): void
56 $this->httpServiceMock = $this->getMockBuilder(Services::class)
57 ->disableOriginalConstructor()
66 $expectedContentValue =
'';
68 $response = $this->getMockBuilder(ResponseInterface::class)
69 ->disableOriginalConstructor()
73 ->method(
'withHeader')
77 $this->httpServiceMock->expects($this->once())
81 $this->httpServiceMock->expects($this->once())
82 ->method(
'saveResponse')
85 $this->httpServiceMock->expects($this->never())
86 ->method(
'sendResponse');
88 $xAccel =
new XAccel($this->httpServiceMock);
89 $xAccel->prepare(
"this path is never used in this method", null);
91 $this->assertTrue(
true);
99 $expectedHeader =
'X-Accel-Redirect';
100 $path =
'./normal/path';
102 $response = $this->getMockBuilder(ResponseInterface::class)
103 ->disableOriginalConstructor()
107 ->method(
'withHeader')
108 ->with($expectedHeader,
$path)
111 $this->httpServiceMock->expects($this->once())
115 $this->httpServiceMock->expects($this->once())
116 ->method(
'saveResponse')
119 $this->httpServiceMock->expects($this->once())
120 ->method(
'sendResponse');
123 $xAccel =
new XAccel($this->httpServiceMock);
124 $xAccel->deliver(
$path,
false);
132 $expectedHeader =
'X-Accel-Redirect';
133 $path =
'./data/path/to/what/ever';
134 $expectedPath =
'/secured-data/path/to/what/ever';
136 $response = $this->getMockBuilder(ResponseInterface::class)
137 ->disableOriginalConstructor()
141 ->method(
'withHeader')
142 ->with($expectedHeader, $expectedPath)
145 $this->httpServiceMock->expects($this->once())
149 $this->httpServiceMock->expects($this->once())
150 ->method(
'saveResponse')
153 $this->httpServiceMock->expects($this->once())
154 ->method(
'sendResponse');
156 $xAccel =
new XAccel($this->httpServiceMock);
157 $xAccel->deliver(
$path,
false);
testDeliverWithDataPathWhichShouldSucceed()
Services $httpServiceMock
testPrepareWhichShouldSucceed()
testDeliverWithNormalPathWhichShouldSucceed()