3declare(strict_types=1);
9use PHPUnit\Framework\TestCase;
10use Psr\Http\Message\ResponseInterface;
46 protected function setUp(): void
48 $this->httpServiceMock = $this->getMockBuilder(Services::class)
49 ->disableOriginalConstructor()
58 $expectedHeader =
'X-Sendfile';
61 $response = $this->getMockBuilder(ResponseInterface::class)
62 ->disableOriginalConstructor()
66 ->method(
'withHeader')
67 ->with($expectedHeader, $filePath)
70 $this->httpServiceMock->expects($this->once())
74 $this->httpServiceMock->expects($this->once())
75 ->method(
'saveResponse')
78 $this->httpServiceMock->expects($this->once())
79 ->method(
'sendResponse');
81 $fileDeliveryType =
new XSendfile($this->httpServiceMock);
82 $fileDeliveryType->deliver($filePath,
false);
Services $httpServiceMock
testSendFileWithXSendHeaderWhichShouldSucceed()
@Test