$this->
assertSame('X-FooBar: unit-test',
$requestOptions['headers'
][0
]);
$this->
assertSame('Content-Type: text/html',
$requestOptions['headers'
][1
]);
$response =
$client->
request('GET', 'http://example.com/foobar-foo',
['headers' =>
['X-FooBar' => 'unit-test'
]]);
$requestOptions =
$response->
getRequestOptions();
$this->
assertSame('X-FooBar: unit-test',
$requestOptions['headers'
][0
]);
$this->
assertSame('Content-Type: text/html',
$requestOptions['headers'
][1
]);
} public function testForBaseUri() { $client = ScopingHttpClient::
forBaseUri(new MockHttpClient(null, null
), 'http://example.com/foo'
);
$response =
$client->
request('GET', '/bar'
);
$this->
assertSame('http://example.com/foo',
implode('',
$response->
getRequestOptions()['base_uri'
]));
$this->
assertSame('http://example.com/bar',
$response->
getInfo('url'
));
$response =
$client->
request('GET', 'http://foo.bar/'
);
$this->
assertNull($response->
getRequestOptions()['base_uri'
]);
}}