55 protected function setUp() : void
59 $this->mockRequestFactory = $this->getMockBuilder(RequestFactory::class)->setMethods([
'create'])->getMock();
62 $this->mockResponseFactory = $this->getMockBuilder(ResponseFactory::class)->setMethods([
'create'])->getMock();
65 $this->mockSenderStrategy = $this->getMockBuilder(ResponseSenderStrategy::class)->getMock();
68 $this->mockCookieJarFactory = $this->getMockBuilder(CookieJarFactory::class)->getMock();
71 $this->httpState =
new HTTPServices($this->mockSenderStrategy, $this->mockCookieJarFactory, $this->mockRequestFactory, $this->mockResponseFactory);
80 $expectedRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
81 $wrongRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
83 $this->mockRequestFactory->expects($this->once())
85 ->willReturn($expectedRequest, $wrongRequest);
90 $request1 = $this->httpState->request();
93 $request2 = $this->httpState->request();
96 $this->assertEquals($expectedRequest, $request1);
97 $this->assertEquals($expectedRequest, $request2);
106 $expectedResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
107 $wrongResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
109 $this->mockResponseFactory->expects($this->once())
111 ->willReturn($expectedResponse, $wrongResponse);
116 $response1 = $this->httpState->response();
119 $response2 = $this->httpState->response();
122 $this->assertEquals($expectedResponse, $response1);
123 $this->assertEquals($expectedResponse, $response2);
testRequestWhichShouldGenerateANewRequestOnce()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testResponseWhichShouldGenerateANewResponseOnce()
Provides an interface to the ILIAS HTTP services.