public function testFetchAccessTokens()
 {
     $tempCredentials = new ehough_coauthor_api_v1_Credentials('a', 'b');
     $this->_mockHttpClient->shouldReceive('execute')->once()->with(ehough_mockery_Mockery::on(array($this, '__callbackFetchTokensHttpRequest')))->andReturn($this->_mockHttpResponse);
     $this->_mockSigner->shouldReceive('signForAccessTokenRequest')->once()->with(ehough_mockery_Mockery::on(array($this, '__callbackFetchTokensHttpRequest')), $this->_mockClientCredentials, $tempCredentials, 'some-code');
     $this->_mockServer->shouldReceive('onCredentialsOrTokenRequest')->once()->with(ehough_mockery_Mockery::on(array($this, '__callbackFetchTokensHttpRequest')));
     $this->_mockServer->shouldReceive('onAfterCredentialsOrTokenRequest')->once()->with(ehough_mockery_Mockery::on(array($this, '__callbackFetchTokensHttpRequest')), $this->_mockHttpResponse);
     $result = $this->_sut->fetchToken($this->_mockClientCredentials, $this->_mockServer, $tempCredentials, 'some-code');
     $this->assertEquals('token', $result->getIdentifier());
 }
예제 #2
0
 public function testCommence()
 {
     $mockCreds = new ehough_coauthor_api_v1_Credentials('a', 'z');
     $this->_mockCredentialsFetcher->shouldReceive('fetchTemporaryCredentials')->once()->with($this->_mockClientCredentials, $this->_mockServer, $this->_mockRedirectUrl)->andReturn($mockCreds);
     $this->_mockCredentialsStorage->shouldReceive('store')->once()->with($mockCreds);
     $this->_sut->commenceNewAuthorization($this->_mockServer, $this->_mockRedirectUrl, $this->_mockClientCredentials);
 }