/**
  * Create a new instance of the adapter by wrapping an existing object.
  * @param HTTP_OAuth_Consumer $object
  * @return Imgur_HTTPAdapter_OAuth_HTTPOAuthConsumer
  **/
 public static function createByWrapping($object)
 {
     $foo = new Imgur_HTTPAdapter_OAuth_HTTPOAuthConsumer();
     $consumer_request = clone $object->getOAuthConsumerRequest();
     // Oh, what a mess.
     $consumer_request->setSecrets($object->getSecrets());
     $consumer_request->setParameters(array('oauth_consumer_key' => $object->getKey(), 'oauth_signature_method' => $object->getSignatureMethod(), 'oauth_token' => $object->getToken()));
     $foo->wrap($consumer_request);
     return $foo;
 }
Ejemplo n.º 2
0
 /**
  * testAccept 
  * 
  * @return void
  */
 public function testAccept()
 {
     $consumer = new HTTP_OAuth_Consumer('key', 'secret');
     $request = new HTTP_OAuth_Consumer_Request();
     $this->assertFalse($request === $consumer->getOAuthConsumerRequest());
     $consumer->accept($request);
     $this->assertTrue($request === $consumer->getOAuthConsumerRequest());
     $this->assertTrue($request === $consumer->getOAuthConsumerRequest());
 }