Ejemplo n.º 1
0
 /**
  * @test
  */
 public function itShouldAddGoogleAuthenticationCodeToFurtherRequests()
 {
     $url = 'http://example.com';
     $header = array('x-test: 1');
     $authCode = '123';
     $response = $this->getMock('\\Buzz\\Message\\Response', array(), array(), '', false);
     $response->expects($this->once())->method('getContent')->will($this->returnValue('Auth=' . $authCode));
     $this->httpClient->expects($this->once())->method('post')->with('https://www.google.com/accounts/ClientLogin')->will($this->returnValue($response));
     $this->httpClient->expects($this->once())->method('get')->with($url, array_merge($header, array('Authorization: GoogleLogin Auth=' . $authCode)));
     $client = new Client($this->httpClient, '', '', '');
     $client->get($url, $header);
 }
Ejemplo n.º 2
0
 /**
  * @param $url
  * @param  array                  $headers
  * @return \Buzz\Message\Response
  */
 public function get($url, $headers = array())
 {
     $response = $this->client->get($url, $headers);
     $this->handleResponseAuthHeader($response);
     return $response;
 }