Beispiel #1
0
 /**
  * @covers OAuth\OAuth2\Service\Foursquare::__construct
  * @covers OAuth\OAuth2\Service\Foursquare::getAccessTokenEndpoint
  */
 public function testGetAccessTokenEndpoint()
 {
     $service = new Foursquare($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'));
     $this->assertSame('https://foursquare.com/oauth2/access_token', (string) $service->getAccessTokenEndpoint());
 }
Beispiel #2
0
 /**
  * @covers OAuth\OAuth2\Service\Foursquare::__construct
  * @covers OAuth\OAuth2\Service\Foursquare::request
  */
 public function testRequestShortPath()
 {
     $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
     $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0));
     $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface');
     $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES));
     $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo'));
     $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
     $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token));
     $service = new Foursquare($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $storage);
     $this->assertSame('https://api.foursquare.com/v2/my/awesome/path?v=20130829', $service->request('my/awesome/path')->getAbsoluteUri());
 }