25use PHPUnit\Framework\MockObject\MockObject;
 
   27use Psr\Http\Message\ResponseInterface;
 
   28use Psr\Http\Message\ServerRequestInterface;
 
   70    protected function setUp(): void
 
   73        $this->mockRequestFactory = $this->getMockBuilder(RequestFactory::class)->getMock();
 
   75        $this->mockResponseFactory = $this->getMockBuilder(ResponseFactory::class)->getMock();
 
   77        $this->mockSenderStrategy = $this->getMockBuilder(ResponseSenderStrategy::class)->getMock();
 
   79        $this->mockCookieJarFactory = $this->getMockBuilder(CookieJarFactory::class)->getMock();
 
   81        $this->mockDurationFactory = $this->createMock(DurationFactory::class);
 
   83        $this->httpState = 
new RawHTTPServices($this->mockSenderStrategy, $this->mockCookieJarFactory, $this->mockRequestFactory, $this->mockResponseFactory, $this->mockDurationFactory);
 
   92        $expectedRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
 
   93        $wrongRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
 
   95        $this->mockRequestFactory->expects($this->once())
 
   97            ->willReturn($expectedRequest, $wrongRequest);
 
  102        $request1 = $this->httpState->request();
 
  105        $request2 = $this->httpState->request();
 
  108        $this->assertEquals($expectedRequest, $request1);
 
  109        $this->assertEquals($expectedRequest, $request2);
 
  118        $expectedResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
 
  119        $wrongResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
 
  121        $this->mockResponseFactory->expects($this->once())
 
  123            ->willReturn($expectedResponse, $wrongResponse);
 
  128        $response1 = $this->httpState->response();
 
  131        $response2 = $this->httpState->response();
 
  134        $this->assertEquals($expectedResponse, $response1);
 
  135        $this->assertEquals($expectedResponse, $response2);
 
GlobalHttpState $httpState
 
RequestFactory $mockRequestFactory
 
ResponseSenderStrategy $mockSenderStrategy
 
testResponseWhichShouldGenerateANewResponseOnce()
@Test
 
ResponseFactory $mockResponseFactory
 
DurationFactory $mockDurationFactory
 
testRequestWhichShouldGenerateANewRequestOnce()
@Test
 
CookieJarFactory $mockCookieJarFactory
 
Provides an interface to the ILIAS HTTP services.
 
Interface GlobalHttpState.
 
Interface ResponseSenderStrategy.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...