public function setUp() { $streamClient = new Client\StreamClient(); $streamClient->setTimeout(3); $curlClient = new Client\CurlClient(); $curlClient->setTimeout(3); $this->clients[] = $streamClient; $this->clients[] = $curlClient; }
/** * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext */ public function testRetrieveResponseThrowsExceptionOnInvalidRequest() { $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); $endPoint->expects($this->any())->method('getHost')->will($this->returnValue('dskjhfckjhekrsfhkehfkreljfrekljfkre')); $endPoint->expects($this->any())->method('getAbsoluteUri')->will($this->returnValue('dskjhfckjhekrsfhkehfkreljfrekljfkre')); $client = new StreamClient(); $response = $client->retrieveResponse($endPoint, '', array('Content-type' => 'foo/bar'), 'get'); $response = json_decode($response, true); $this->assertSame('foo/bar', $response['headers']['Content-Type']); }