Definition at line 30 of file HTTPServicesTest.php.
◆ setUp()
ILIAS\DI\HTTPServicesTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 55 of file HTTPServicesTest.php.
55 : void
56 {
57 parent::setUp();
58
59 $this->mockRequestFactory = $this->getMockBuilder(RequestFactory::class)->setMethods(['create'])->getMock();
60
61
62 $this->mockResponseFactory = $this->getMockBuilder(ResponseFactory::class)->setMethods(['create'])->getMock();
63
64
65 $this->mockSenderStrategy = $this->getMockBuilder(ResponseSenderStrategy::class)->getMock();
66
67
68 $this->mockCookieJarFactory = $this->getMockBuilder(CookieJarFactory::class)->getMock();
69
70
71 $this->httpState = new HTTPServices($this->mockSenderStrategy, $this->mockCookieJarFactory, $this->mockRequestFactory, $this->mockResponseFactory);
72 }
◆ testRequestWhichShouldGenerateANewRequestOnce()
ILIAS\DI\HTTPServicesTest::testRequestWhichShouldGenerateANewRequestOnce |
( |
| ) |
|
@Test
Definition at line 78 of file HTTPServicesTest.php.
79 {
80 $expectedRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
81 $wrongRequest = $this->getMockBuilder(ServerRequestInterface::class)->getMock();
82
83 $this->mockRequestFactory->expects($this->once())
84 ->method('create')
85 ->willReturn($expectedRequest, $wrongRequest);
86
87
88
89
90 $request1 = $this->httpState->request();
91
92
93 $request2 = $this->httpState->request();
94
95
96 $this->assertEquals($expectedRequest, $request1);
97 $this->assertEquals($expectedRequest, $request2);
98 }
◆ testResponseWhichShouldGenerateANewResponseOnce()
ILIAS\DI\HTTPServicesTest::testResponseWhichShouldGenerateANewResponseOnce |
( |
| ) |
|
@Test
Definition at line 104 of file HTTPServicesTest.php.
105 {
106 $expectedResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
107 $wrongResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
108
109 $this->mockResponseFactory->expects($this->once())
110 ->method('create')
111 ->willReturn($expectedResponse, $wrongResponse);
112
113
114
115
116 $response1 = $this->httpState->response();
117
118
119 $response2 = $this->httpState->response();
120
121
122 $this->assertEquals($expectedResponse, $response1);
123 $this->assertEquals($expectedResponse, $response2);
124 }
◆ $httpState
◆ $mockCookieJarFactory
◆ $mockRequestFactory
RequestFactory MockObject ILIAS\DI\HTTPServicesTest::$mockRequestFactory |
|
private |
◆ $mockResponseFactory
◆ $mockSenderStrategy
The documentation for this class was generated from the following file: