+
+ public function testSetBaseUri()
+ {
+ $guzzle = $this->getGuzzle([], ['base_uri' => 'http://example.com/']);
+ $client = new Client();
+ $client->setClient($guzzle);
+
+ $this->assertNull($client->getServerParameter('HTTPS', null));
+ $this->assertSame('example.com', $client->getServerParameter('HTTP_HOST'));
+
+ $client->request('GET', '/foo');
+ $this->assertSame('http://example.com/foo', (string) end($this->history)['request']->getUri());
+ }
+
+ public function testSetHttpsBaseUri()
+ {
+ $guzzle = $this->getGuzzle([], ['base_uri' => 'https://example.com:1234']);
+ $client = new Client();
+ $client->setClient($guzzle);
+
+ $this->assertSame('on', $client->getServerParameter('HTTPS'));
+ $this->assertSame('example.com:1234', $client->getServerParameter('HTTP_HOST'));
+
+ $client->request('GET', '/foo');
+ $this->assertSame('https://example.com:1234/foo', (string) end($this->history)['request']->getUri());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Setting a path in the Guzzle "base_uri" config option is not supported by Goutte yet.
+ */
+ public function testSetBaseUriWithPath()
+ {
+ $guzzle = $this->getGuzzle([], ['base_uri' => 'http://example.com/foo/']);
+ $client = new Client();
+ $client->setClient($guzzle);
+ }