コード例 #1
0
 public function it_authenticate_credentials(CredentialInterface $credential, BetfairGuzzleClient $betfairHttpClient, Response $response)
 {
     $credential->getUsername()->shouldBeCalled()->willReturn('usr1');
     $credential->getPassword()->shouldBeCalled()->willReturn('pwd1');
     $credential->getApplicationKey()->shouldBeCalled()->willReturn('appkey');
     $expectedLoginGuzzleParameters = array('X-Application' => 'appkey', 'username' => 'usr1', 'password' => 'pwd1');
     $betfairHttpClient->betfairLogin($expectedLoginGuzzleParameters)->shouldBeCalled()->willReturn($response);
     $response->getStatusCode()->shouldBeCalled()->willReturn(200);
     $response->getBody()->shouldBeCalled()->willReturn(json_encode(array("status" => "SUCCESS", "token" => "12345")));
     $credential->setSessionToken("12345")->shouldBeCalled();
     $this->authenticateCredential();
 }
コード例 #2
0
 /**
  * Login and set the sessionToken in Credential object
  */
 public function authenticateCredential()
 {
     $sessionToken = $this->login();
     $this->credential->setSessionToken($sessionToken);
 }