示例#1
0
 function it_should_not_call_refresh_method_if_there_is_no_token(ClientInterface $mockedClient, RequestInterface $failedRequest, StorageInterface $mockedStorage)
 {
     $mockedClient->send($failedRequest)->willThrow('\\Omniphx\\Forrest\\Exceptions\\TokenExpiredException');
     $mockedClient->createRequest(Argument::any(), Argument::any(), Argument::any())->willReturn($failedRequest);
     $mockedStorage->getRefreshToken()->willThrow('\\Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException');
     $this->shouldThrow('Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException')->duringRequest('url', ['key' => 'value']);
 }
示例#2
0
 public function it_should_not_call_refresh_method_if_there_is_no_token(ClientInterface $mockedClient, RequestInterface $failedRequest, StorageInterface $mockedStorage)
 {
     $failedRequest = new Request('GET', 'fakeurl');
     $failedResponse = new Response(401);
     $requestException = new RequestException('Salesforce token has expired', $failedRequest, $failedResponse);
     $mockedClient->send($failedRequest)->willThrow($requestException);
     $mockedClient->createRequest(Argument::any(), Argument::any(), Argument::any())->willReturn($failedRequest);
     $mockedStorage->getRefreshToken()->willThrow('\\Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException');
     $this->shouldThrow('Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException')->duringRequest('url', ['key' => 'value']);
 }
示例#3
0
 public function it_should_not_call_refresh_method_if_there_is_no_token(ClientInterface $mockedClient, RequestInterface $failedRequest, StorageInterface $mockedStorage)
 {
     $failedRequest = new Request('GET', 'fakeurl');
     $failedResponse = new Response(401);
     $requestException = new RequestException('Salesforce token has expired', $failedRequest, $failedResponse);
     //First request throws an exception
     $mockedClient->request('get', 'url', ['headers' => ['Authorization' => 'Oauth accessToken', 'Accept' => 'application/json', 'Content-Type' => 'application/json']])->shouldBeCalled(1)->willThrow($requestException);
     $mockedStorage->getRefreshToken()->willThrow('\\Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException');
     $this->shouldThrow('\\Omniphx\\Forrest\\Exceptions\\MissingRefreshTokenException')->duringRequest('url', ['key' => 'value']);
 }