예제 #1
0
 /**
  * This test only captures a regression in php 5.3.
  *
  * @covers OAuth\OAuth1\Service\AbstractService::request
  */
 public function testRequestNonArrayBody()
 {
     $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
     $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!'));
     $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface');
     $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
     $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token));
     $service = new Mock($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $storage, $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'));
     $this->assertSame('response!', $service->request('/my/awesome/path', 'GET', 'A text body'));
 }
예제 #2
0
 /**
  * @covers OAuth\OAuth1\Service\AbstractService::request
  * @covers OAuth\OAuth1\Service\AbstractService::determineRequestUriFromPath
  * @covers OAuth\OAuth1\Service\AbstractService::service
  * @covers OAuth\OAuth1\Service\AbstractService::getExtraApiHeaders
  * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForAPIRequest
  * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo
  * @covers OAuth\OAuth1\Service\AbstractService::generateNonce
  * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod
  * @covers OAuth\OAuth1\Service\AbstractService::getVersion
  */
 public function testRequest()
 {
     $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface');
     //$token->expects($this->once())->method('getRequestTokenSecret')->will($this->returnValue('baz'));
     $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
     $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token));
     $service = new Mock($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), new Browser(), $storage, $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), 'some');
     $this->assertSame('response!', $service->request('/my/awesome/path', ['root' => 'response!'])['body']['root']);
 }