public function it_raise_betfar_login_exception_when_response_not_have_a_200_status_code(CredentialInterface $credential, BetfairGuzzleClient $betfairHttpClient, Response $response) { $credential->getUsername()->shouldBeCalled()->willReturn('usr1'); $credential->getPassword()->shouldBeCalled()->willReturn('pwd1'); $credential->getApplicationKey()->shouldBeCalled()->willReturn('appkey'); $expectedLoginGuzzleParameters = array('username' => 'usr1', 'password' => 'pwd1', 'X-Application' => 'appkey'); $betfairHttpClient->betfairLogin($expectedLoginGuzzleParameters)->shouldBeCalled()->willReturn($response); $response->getStatusCode()->shouldBeCalled()->willReturn(401); $response->getBody()->shouldNotBeCalled(); $this->shouldThrow('Betfair\\Exception\\BetfairLoginException')->duringAuthenticateCredential(); }
private function builtLoginArrayParameters() { return array('X-Application' => $this->credential->getApplicationKey(), 'username' => $this->credential->getUsername(), 'password' => $this->credential->getPassword()); }