/** * @group 5956 */ public function testScalarServerResponseThrowsException() { $response = $this->makeHttpResponseFrom('false'); $this->httpAdapter->setResponse($response); $this->setExpectedException('Zend\\Json\\Exception\\ExceptionInterface'); $this->jsonClient->call('foo'); }
public function testCustomHttpClientUserAgentIsNotOverridden() { $this->assertFalse($this->httpClient->getHeader('User-Agent'), 'UA is null if no request was made'); $this->setServerResponseTo(null); $this->assertNull($this->jsonClient->call('method')); $this->assertSame('Zend_Json_Server_Client', $this->httpClient->getHeader('User-Agent'), 'If no custom UA is set, set Zend_Json_Server_Client'); $expectedUserAgent = 'Zend_Json_Server_Client (custom)'; $this->httpClient->setHeaders(array('User-Agent' => $expectedUserAgent)); $this->setServerResponseTo(null); $this->assertNull($this->jsonClient->call('method')); $this->assertSame($expectedUserAgent, $this->httpClient->getHeader('User-Agent')); }