5require_once(
'./libs/composer/vendor/autoload.php');
 
   10use PHPUnit\Framework\TestCase;
 
   25    use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
 
   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);
 
An exception for terminatinating execution or to throw for unit testing.
Provides an interface to the ILIAS HTTP services.
testSendFileWithXSendHeaderWhichShouldSucceed()
@Test
Interface GlobalHttpState.
Representation of an outgoing, server-side response.