public function testSettingNoHttpClientUriForcesClientToSetUri() { $baseUri = 'http://foo:80/'; $this->httpAdapter = new TestAdapter(); $this->httpClient = new HttpClient(null, array('adapter' => $this->httpAdapter)); $this->jsonClient = new Client($baseUri); $this->jsonClient->setHttpClient($this->httpClient); $this->setServerResponseTo(null); $this->assertNull($this->jsonClient->getHttpClient()->getRequest()->getUriString()); $this->jsonClient->call('foo'); $uri = $this->jsonClient->getHttpClient()->getUri(); $this->assertEquals($baseUri, $uri->toString()); }
public function testSettingHttpClientViaContructor() { $jsonClient = new Client('http://foo', $this->httpClient); $httpClient = $jsonClient->getHttpClient(); $this->assertSame($this->httpClient, $httpClient); }