Skip to content

Commit a432c98

Browse files
authored
Merge pull request #483 from ITernovtsiy/master
Test for using userInfo from server configuration when sending request
2 parents e6e9218 + 6cdd181 commit a432c98

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Unit/ProxyClient/HttpDispatcherTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,26 @@ public function testSetBasePathWithHost()
196196
$this->assertEquals('fos.lo', $requests[0]->getHeaderLine('Host'));
197197
}
198198

199+
public function testServerWithUserInfo()
200+
{
201+
$httpDispatcher = new HttpDispatcher(
202+
['http://userone:[email protected]', 'http://127.0.0.2', 'http://usertwo:[email protected]'],
203+
'fos.lo',
204+
$this->httpClient
205+
);
206+
207+
$request = $this->messageFactory->createRequest('PURGE', '/path');
208+
$httpDispatcher->invalidate($request);
209+
$httpDispatcher->flush();
210+
211+
$requests = $this->getRequests();
212+
213+
$this->assertCount(3, $requests);
214+
$this->assertEquals('userone:passone', $requests[0]->getUri()->getUserInfo());
215+
$this->assertEquals('', $requests[1]->getUri()->getUserInfo());
216+
$this->assertEquals('usertwo:passtwo', $requests[2]->getUri()->getUserInfo());
217+
}
218+
199219
public function testSetBasePathWithPath()
200220
{
201221
$httpDispatcher = new HttpDispatcher(

0 commit comments

Comments
 (0)