58 $this->mockRequestFactory = \Mockery::mock(RequestFactory::class);
59 $this->mockResponseFactory = \Mockery::mock(ResponseFactory::class);
60 $this->mockSenderStrategy = \Mockery::mock(ResponseSenderStrategy::class);
61 $this->mockCookieJarFactory = \Mockery::mock(CookieJarFactory::class);
64 $this->httpState =
new HTTPServices($this->mockSenderStrategy, $this->mockCookieJarFactory, $this->mockRequestFactory, $this->mockResponseFactory);
73 $expectedRequest = \Mockery::mock(RequestInterface::class);
74 $wrongRequest = \Mockery::mock(RequestInterface::class);
76 $this->mockRequestFactory->shouldReceive(
"create")->withNoArgs()->once()->andReturnValues([ $expectedRequest, $wrongRequest ]);
81 $request1 = $this->httpState->request();
84 $request2 = $this->httpState->request();
87 $this->assertEquals($expectedRequest, $request1);
88 $this->assertEquals($expectedRequest, $request2);
97 $expectedResponse = \Mockery::mock(ResponseInterface::class);
98 $wrongResponse = \Mockery::mock(ResponseInterface::class);
100 $this->mockResponseFactory->shouldReceive(
"create")->withNoArgs()->once()->andReturnValues([ $expectedResponse, $wrongResponse ]);
105 $response1 = $this->httpState->response();
108 $response2 = $this->httpState->response();
111 $this->assertEquals($expectedResponse, $response1);
112 $this->assertEquals($expectedResponse, $response2);
testRequestWhichShouldGenerateANewRequestOnce()
testResponseWhichShouldGenerateANewResponseOnce()
Provides an interface to the ILIAS HTTP services.