function it_should_callback(ClientInterface $mockedClient, RequestInterface $mockedRequest, ResponseInterface $tokenResponse, ResponseInterface $versionResponse, SessionInterface $mockedSession) { $mockedClient->post('https://login.salesforce.com/services/oauth2/token', Argument::type('array'))->shouldBeCalled(1)->willReturn($tokenResponse); $mockedClient->send(Argument::any())->shouldBeCalled(1)->willReturn($versionResponse); $mockedClient->createRequest(Argument::any(), Argument::any(), Argument::any())->willReturn($mockedRequest); $tokenResponse->json()->shouldBeCalled(1)->willReturn(array('access_token' => 'value1', 'refresh_token' => 'value2')); $versionResponse->json()->shouldBeCalled()->willReturn([['version' => '30.0'], ['version' => '31.0']]); $mockedSession->putToken(Argument::type('array'))->shouldBeCalled(); $mockedSession->putRefreshToken(Argument::exact('value2'))->shouldBeCalled(); $mockedSession->put(Argument::type('string'), Argument::type('array'))->shouldBeCalled(); $this->callback()->shouldReturn(null); }